forked from verdnatura/hedera-web
75 lines
1.2 KiB
JavaScript
75 lines
1.2 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.
|
|
*
|
|
* @param {Object} changes The changed params and its values
|
|
*/
|
|
,changed: function (changes)
|
|
{
|
|
this.emit ('change', changes);
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|
|
});
|