diff --git a/ignite-html.js b/ignite-html.js index 4a190a5..d1de50b 100644 --- a/ignite-html.js +++ b/ignite-html.js @@ -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.