/// <summary> /// This works like the Prototype.js Object.Extend method. What it does is it takes the properties /// and methods in <em>literal</em> and overrides any methods and properties in this /// JSObjectLiteral with the same name, and adds any new properties and methods that currently /// are not in this JSObjectLiteral. /// </summary> /// <param name="literal">The JSObjectLiteral to extend this with.</param> public void Extend(JSObjectLiteral literal) { literal._items.ForEach(item => { this.RemoveName(item.Name); this.Add(item); }); }
/// <summary> /// Appends a javascript property of type ObjectLiteral to the end of the collection that represents the specified propery name and value. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="value">The value.</param> /// <exception cref="System.ArgumentException">This will be thrown if the collection already contains the key.</exception> public void AddObjectLiteralProperty(string propertyName, JSObjectLiteral value) { if (ContainsName(propertyName)) { throw new ArgumentException("This collection already contains the name " + propertyName); } _items.Add(new JSObjectLiteralProperty(propertyName, value)); }
/// <summary> /// This works like the Prototype.js Object.Extend method. What it does is it takes the properties /// and methods in <em>literal</em> and overrides any methods and properties in this /// JSObjectLiteralProperty with the same name, and adds any new properties and methods that currently /// are not in this JSObjectLiteral. /// </summary> /// <param name="literal"></param> public void Extend(JSObjectLiteral literal) { this._value.Extend(literal); }
public JSObjectLiteralProperty(string propertyName, JSObjectLiteral value) : this(propertyName) { this._value = value; }