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 object
Object The object to which the properties are added.
properties
Object 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.
value
get
set
enumerable
istrue
by default, butfalse
ifvalue
is a functionwritable
istrue
by default, butfalse
if thename
begins with an underscore,_
.configurable
istrue
by defaultdistinct
is deprecated, but conveys the intention that thevalue
should be duplicated for each instance, but the means of cloning is ill-defined and temperamental.
Parameters:
Name Type Description object
Object The object on which to define the property.
name
string The name of the property to define, or modify.
descriptor
Object 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 object
Object 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 anObject
Object A object.
propertyName
string The name of a property belonging to
anObject
.attributeName
string The name of a property's attribute.
Returns:
attributes array
-
getPropertyAttributes(anObject, attributeName) → {Object} <constructor> source
-
Parameters:
Name Type Description anObject
Object An object.
attributeName
string 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 anObject
Object 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 prototypeProperties
Object a object mapping property names to customized Montage property descriptors, to be applied to the new prototype
constructorProperties
Object <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 name
string -
equals(anObject) → {boolean} source
-
Returns true if two objects are equal, otherwise returns false.
Parameters:
Name Type Description anObject
Object The object to compare for equality.
Returns: boolean
Returns
true
if the calling object andanObject
are identical and theiruuid
properties are also equal. Otherwise, returnsfalse
.
Generated from a4679af