Added IgniteProperty create method to construct properties onto any object in the same way they are done for components.
This commit is contained in:
parent
fca9af5f73
commit
73bf9812dd
@ -48,6 +48,25 @@ class IgniteProperty {
|
||||
this.patchArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ignite property on the target object that responds to rendering states.
|
||||
* @param {Any} target
|
||||
* @param {String} name
|
||||
* @param {Any} value
|
||||
* @returns {Any} The target passed to the function.
|
||||
*/
|
||||
static create(target, name, value) {
|
||||
var property = new IgniteProperty(value);
|
||||
|
||||
Object.defineProperty(target, name, {
|
||||
get: () => { return (IgniteRendering.rendering ? property : property.value); },
|
||||
|
||||
set: (value) => { property.value = value; }
|
||||
});
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of this IgniteProperty.
|
||||
* @returns {Any} The value of this IgniteProperty.
|
||||
|
Loading…
x
Reference in New Issue
Block a user