Mixin: PropertyHolder

domjscomp. PropertyHolder

Mixin adds methods for setting deep properties and add observers

Methods


destroy()

Destroy observers

getProperty(property)

Get deep property using path
Parameters:
Name Type Description
property string property path
Returns:
property value
Type
*
Example
prop1.prop2.prop3

hasProperty(property)

Check if property exists
Parameters:
Name Type Description
property string property path
Returns:
has / has not
Type
boolean
Example
prop1.prop2.prop3

observeProperty(property, callback, scope, create, value)

Observe property for changes. Only one observer is alowed for each property
Parameters:
Name Type Description
property string property path
callback function change callback
scope object | undefined callback scope
create boolean create property if it doesn't exists
value * start value for created property
Returns:
returns self for chaining
Type
object
Example
prop1.prop2.prop3

removeObserver(property)

Remove observer
Parameters:
Name Type Description
property string property path
Returns:
returns self for chaining
Type
object

setProperty(property, value)

Set deep property using path
Parameters:
Name Type Description
property string property path
value * property value
Returns:
returns self for chaining
Type
object
Example
prop1.prop2.prop3