15 lines
625 B
Plaintext
15 lines
625 B
Plaintext
<element class='plate' weight=45 units='kgs' />
|
|
|
|
{type: 'bar', weight:45, units: 'kgs'}
|
|
{type: 'plate', weight:45, units: 'kgs'}
|
|
|
|
ALL weight is stored in terms of grams, however each weight defines what it should be represented as in the UI via the `units` field.
|
|
|
|
Object Templates:
|
|
{ type: 'bar', weight: 45000, children: [{type: 'plate'}] }
|
|
{ type: 'plate', weight: true, units: ['kgs', 'lbs'] }
|
|
|
|
Unit Templates:
|
|
{ type: 'kgs', get: function(grams) { return grams/1000 }, set: function(kgs) { return kgs*1000 } }
|
|
{ type: 'lbs', get: function(grams) { return grams/453.59237 }, set: function(lbs) { return lbs*453.59237 } }
|