Class: Model

core. Model

A base Model class. Most other models are instances of this base Model.


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
object Object

The object to define the property on

propName String

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
object Object

The object to define the property on

propName String

The name of the property to define on the object

ItemModel function

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
object Object

The object to define the property on

type String

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
object Object

[description]

propName String

[description]

validate function

[description]