forked from verdnatura/hedera-web
74 lines
1.1 KiB
JavaScript
74 lines
1.1 KiB
JavaScript
|
|
/**
|
|
* Holds a plain key-value javascript object and monitorizes
|
|
* changes over it.
|
|
*/
|
|
module.exports = new Class
|
|
({
|
|
Properties:
|
|
{
|
|
/**
|
|
* The internal object with the params.
|
|
*/
|
|
params:
|
|
{
|
|
type: Object
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets a value from the set.
|
|
*
|
|
* @param {String} field The field name
|
|
* @return {*} The field value
|
|
*/
|
|
,get: function () {}
|
|
|
|
/**
|
|
* Sets a value on the set.
|
|
*
|
|
* @param {String} field The field name
|
|
* @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.
|
|
*/
|
|
,changed: function ()
|
|
{
|
|
this.emit ('change');
|
|
}
|
|
|
|
/**
|
|
* 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 ();
|
|
}
|
|
|
|
/**
|
|
* Copies all values from another lot.
|
|
*
|
|
* @param {LotIface} lot The source lot
|
|
*/
|
|
,assignLot: function (lot)
|
|
{
|
|
this.assign (lot.params);
|
|
}
|
|
});
|
|
|