- KVOObject#event:{key}_changed
- KVOObject#event:changed
Methods
# set(key, value, overwriteopt)
Sets the value for the given key. If the new value is different from the old value, or if the overwrite parameter is true, the value is set and the appropriate events are emitted.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string
|
The key to set. | ||
value |
*
|
The new value. | ||
overwrite |
boolean
|
<optional> |
false | If true, the value is set even if it's the same as the old value. |
Events
# changed
This event will fire when any value is changed.
Properties:
Name | Type | Description |
---|---|---|
args |
Object
|
|
key |
string
|
The key of the value that has changed. |
newValue |
*
|
The new value. |
oldValue |
*
|
The old value. |
Example
instance.addListener('changed', (args) => {...});