0
1
Fork 0
hedera-web-mindshore/js/vn/lot-iface.js

75 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-04-10 16:23:40 +00:00
2017-04-19 06:16:37 +00:00
/**
* Holds a plain key-value javascript object and monitorizes
* changes over it.
*/
2017-04-10 16:23:40 +00:00
module.exports = new Class
({
Properties:
{
/**
* The internal object with the params.
*/
params:
{
type: Object
}
}
/**
* Gets a value from the set.
*
2017-04-21 10:53:15 +00:00
* @param {string} field The field name
2017-04-10 16:23:40 +00:00
* @return {*} The field value
*/
,get: function () {}
/**
* Sets a value on the set.
*
2017-04-21 10:53:15 +00:00
* @param {string} field The field name
2017-04-10 16:23:40 +00:00
* @param {*} value The new field value
*/
,set: function () {}
/**
* Returns an array with the set keys.
*
* @return {Array} The set keys
*/
,keys: function () {}
/**
* Emits the 'change' signal on the set.
2017-04-21 10:53:15 +00:00
*
* @param {Object} changes The changed params and its values
2017-04-10 16:23:40 +00:00
*/
2017-04-21 10:53:15 +00:00
,changed: function (changes)
2017-04-10 16:23:40 +00:00
{
2017-04-21 10:53:15 +00:00
this.emit ('change', changes);
2017-04-10 16:23:40 +00:00
}
/**
* Copies all values from another set.
*
* @param {Object} object The source object
*/
,assign: function (object)
{
for (var key in object)
this.set (key, object[key]);
this.changed ();
}
2017-04-19 06:16:37 +00:00
/**
* Copies all values from another lot.
*
* @param {LotIface} lot The source lot
*/
2017-04-10 16:23:40 +00:00
,assignLot: function (lot)
{
this.assign (lot.params);
}
});