Montage source
The basis of all types using the MontageJS framework.
The Montage constructor provides conveniences for sub-typing (specialize) and common methods for Montage prototype chains.
Methods
-
defineProperties(object, properties) <constructor> source
-
Defines one or more new properties to an object, or modifies existing properties on the object.
Parameters:
Name Type Description objectObject The object to which the properties are added.
propertiesObject An object that maps names to Montage property descriptors.
See: -
defineProperty(object, name, descriptor) <constructor> source
-
Defines a property on an object using a Montage property descriptor. Montage property descriptors extend and slightly vary ECMAScript 5 property descriptors.
valuegetsetenumerableistrueby default, butfalseifvalueis a functionwritableistrueby default, butfalseif thenamebegins with an underscore,_.configurableistrueby defaultdistinctis deprecated, but conveys the intention that thevalueshould be duplicated for each instance, but the means of cloning is ill-defined and temperamental.
Parameters:
Name Type Description objectObject The object on which to define the property.
namestring The name of the property to define, or modify.
descriptorObject A descriptor object that defines the properties being defined or modified.
Example
Montage.defineProperty(Object.prototype, "_eventListenerDescriptors", { enumerable: true | false, serializable: "reference" | "value" | "auto" | false, value: null, writable: true | false }); -
getInfoForObject(object) → {Object} <constructor> source
-
Get the metadata Montage has on the given object
Parameters:
Name Type Description objectObject An object.
Returns: Object
object._montage_metadata
-
getPropertyAttribute(anObject, propertyName, attributeName) <constructor> source
-
Returns the attribute of a property belonging to an object.
Parameters:
Name Type Description anObjectObject A object.
propertyNamestring The name of a property belonging to
anObject.attributeNamestring The name of a property's attribute.
Returns:
attributes array
-
getPropertyAttributes(anObject, attributeName) → {Object} <constructor> source
-
Parameters:
Name Type Description anObjectObject An object.
attributeNamestring The attribute name.
Returns: Object
TODO getPropertyAttributes returns description
-
getSerializablePropertyNames(anObject) → {Array} <constructor> source
-
Returns the names of serializable properties belonging to Montage object.
Parameters:
Name Type Description anObjectObject A Montage object.
Returns: Array
An array containing the names of the serializable properties belonging to
anObject. -
specialize(prototypeProperties, constructorProperties) → {function} <constructor> source
-
Customizes a type with idiomatic JavaScript constructor and prototype inheritance, using ECMAScript 5 property descriptors with customizations for common usage in MontageJS.
Parameters:
Name Type Argument Description prototypePropertiesObject a object mapping property names to customized Montage property descriptors, to be applied to the new prototype
constructorPropertiesObject <nullable>
a object mapping property names to customized Montage property descriptors, to be applied to the new constructor
Returns: function
a constructor function for the new type, which derrives prototypically from
this, with a prototype that inheritsthis.prototype, with the given property descriptors applied. -
super() → {function} <constructor> source
-
Calls the method with the same name as the caller from the parent of the constructor that contains the caller, falling back to a no-op if no such method exists.
Returns: function
this constructor’s parent constructor.
-
callDelegateMethod(name) source
-
This method calls the method named with the identifier prefix if it exists. Example: If the name parameter is "shouldDoSomething" and the caller's identifier is "bob", then this method will try and call "bobShouldDoSomething"
Parameters:
Name Type Description namestring -
equals(anObject) → {boolean} source
-
Returns true if two objects are equal, otherwise returns false.
Parameters:
Name Type Description anObjectObject The object to compare for equality.
Returns: boolean
Returns
trueif the calling object andanObjectare identical and theiruuidproperties are also equal. Otherwise, returnsfalse.
Generated from a4679af