Improved ignite template deconstruct and construct functions. Simplified IgniteObject constructor.
This commit is contained in:
@ -413,6 +413,7 @@ class IgniteProperty {
|
||||
/**
|
||||
* Return the value of the property if we try to convert
|
||||
* the property to a string.
|
||||
* @ignore
|
||||
*/
|
||||
IgniteProperty.prototype.toString = function () {
|
||||
if (this.value) {
|
||||
@ -462,24 +463,7 @@ Array.prototype.getOldPropertyValues = function (property, oldValue) {
|
||||
* The outline of an IgniteObject which contains IgniteProperties.
|
||||
*/
|
||||
class IgniteObject {
|
||||
/**
|
||||
* Creates a new IgniteObject from an object and returns it.
|
||||
* @param {Any} obj The object to create an IgniteObject out of.
|
||||
* @returns {IgniteObject} The ignite object created.
|
||||
*/
|
||||
constructor(obj) {
|
||||
//Only do this if the object is not an ignite object already.
|
||||
if (!(obj instanceof IgniteObject)) {
|
||||
Object.keys(obj).forEach(name => {
|
||||
var prop = new IgniteProperty(obj[name]);
|
||||
Object.defineProperty(this, name, {
|
||||
get: () => { return (IgniteRendering.rendering ? prop : prop.value); },
|
||||
set: (value) => { prop.value = value; }
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return obj;
|
||||
}
|
||||
constructor() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user