new Model()
Methods
-
<static> defineArrayProp(object, propName)
-
A utility function to define an array property on a class which ensures that the array cannot be overwritten. This method does not prevent users from adding new items to the array which are not instances of the class. Use the Collection object to obtain this behavior._
Parameters:
Name Type Description objectObject The object to define the property on
propNameString The name of the property to define on the object
Returns:
Returns the original object with the new property added
- Type
- Object
-
<static> defineModelProp(object, propName, ItemModel)
-
A utility function to define a property on a class which must always be an instance of a certain class._
Parameters:
Name Type Description objectObject The object to define the property on
propNameString The name of the property to define on the object
ItemModelfunction The class to use for this property. Every time this property is set, this model will be instantiated.
Returns:
Returns the original object with the new property added
- Type
- Object
-
<static> defineTypeProp(object, type)
-
Create a "type" property on an object that is non-writable
Parameters:
Name Type Description objectObject The object to define the property on
typeString The value to use for the type
-
<static> defineValidatedProp(object, propName, validate)
-
A utility function that defines a property on a class that validates its value when set.
Parameters:
Name Type Description objectObject [description]
propNameString [description]
validatefunction [description]