forked from verdnatura/hedera-web
66 lines
1004 B
JavaScript
Executable File
66 lines
1004 B
JavaScript
Executable File
/**
|
|
* Simply a linkable value holder.
|
|
**/
|
|
Vn.Param = new Class
|
|
({
|
|
Extends: Vn.Object
|
|
,Tag: 'vn-param'
|
|
,Properties:
|
|
{
|
|
value:
|
|
{
|
|
type: String
|
|
,set: function (x)
|
|
{
|
|
if (Vn.Value.compare (x, this._value))
|
|
return;
|
|
|
|
if (x instanceof Date)
|
|
x = x.clone ();
|
|
|
|
this._value = x;
|
|
|
|
if (this._master && !this.masterLock)
|
|
{
|
|
this.masterLock = true;
|
|
this._master.value = x;
|
|
this.masterLock = false;
|
|
}
|
|
|
|
this.signalEmit ('changed', this._value);
|
|
}
|
|
,get: function ()
|
|
{
|
|
return this._value;
|
|
}
|
|
},
|
|
master:
|
|
{
|
|
type: Vn.Param
|
|
,set: function (x)
|
|
{
|
|
this.link ({_master: x}, {'changed': this._onMasterChange});
|
|
this._onMasterChange ();
|
|
}
|
|
,get: function ()
|
|
{
|
|
return this._master;
|
|
}
|
|
}
|
|
}
|
|
|
|
,_value: undefined
|
|
,_master: null
|
|
,masterLock: false
|
|
|
|
,_onMasterChange: function ()
|
|
{
|
|
if (this.masterLock)
|
|
return;
|
|
|
|
this.masterLock = true;
|
|
this.value = this._master.value;
|
|
this.masterLock = false;
|
|
}
|
|
})
|