Fork me on GitHub
Show:

Model

Extends Backbone.Model
Defined in: ../src/model.js:7

Summary

The base model class for Aeris JS Libraries

See http://backbonejs.org/#Model for documentation

Constructor

aeris.util.aeris.Model

Defined in ../src/model.js:7

Syntax

aeris.util.aeris.Model

(
  • opt_attrs
  • opt_options
)

Summary

Parameters:

  • opt_attrs Object=
  • opt_options Object=
    • validate Boolean=

      If set to true, model will immediately check validation on instantiation.

Methods

bindAttributesTo

Defined in ../src/model.js:225

Syntax

bindAttributesTo

(
  • target
  • attrs
)

Summary

Keep this model updated with values from the target model.

Immediately updates the model with the specified attributes, and updates this model whenever the target model's attributes change.

Parameters:

clone

Defined in ../src/model.js:209

Syntax

clone

(
  • opt_attrs
  • opt_options
)
Model

Summary

Create a copy of the model.

Parameters:

  • opt_attrs Object=

    Attributes to set on the cloned model.

  • opt_options Object=

    Options to pass to cloned mode.

Returns:

getAtPath

Defined in ../src/model.js:179

Syntax

getAtPath

(
  • path
)
*|undefined

Summary

Returns a deep-nested property of a model attribute.

Example: model.set('deepObj', { levelA: { levelB: { foo: 'bar' } } });

model.getAtPath('deepObj.levelA.levelB.foo'); // 'bar'

Returns undefined if the path cannot be resolved.

Parameters:

Returns:

isValid

Defined in ../src/model.js:119

Syntax

isValid

()

Summary

Validate the model's attributes.

normalize_

Defined in ../src/model.js:161

Syntax

normalize_

(
  • attrs
)
Attrs protected

Summary

This method is called every time attributes are set on the model.

Override to provide any additional processing needed for options object structure, etc.

Parameters:

Returns:

Attrs:

Normalized attrs.

onValidationError_

Defined in ../src/model.js:106

Syntax

onValidationError_

(
  • model
  • error
)
private

Summary

Handle 'invalid' events thrown by the model.

Parameters:

set

Defined in ../src/model.js:128

Syntax

set

(
  • config
)
protected

Summary

Normalize attributes before setting

Parameters:

updateWithAttributesOf_

Defined in ../src/model.js:251

Syntax

updateWithAttributesOf_

(
  • target
  • attrs
)
private

Summary

Update the attributes of the model with attributes from another model.

Parameters:

Properties

defaults

Defined in ../src/model.js:41

Syntax

defaults

Unknown

Summary

idAttribute

Defined in ../src/model.js:35

Syntax

idAttribute

Unknown

Summary

options_

Defined in ../src/model.js:47

Syntax

options_

Object private

Summary

The options used when constructing the model.

Events

add

Defined in ../src/model.js:84

Syntax

add

Summary

When a model is added to a {aeris.Collection}.

Event Payload:

  • model aeris.Model
  • collection aeris.Collection

change

Defined in ../src/model.js:69

Syntax

change

Summary

When a model's attribute changes

Event Payload:

  • model aeris.Model

change:[attribute]

Defined in ../src/model.js:75

Syntax

change:[attribute]

Summary

When a model's attribute changes, where [attribute] is the name of the attribute.

Event Payload:

  • model aeris.Model
  • value

remove

Defined in ../src/model.js:93

Syntax

remove

Summary

When a model is removed from a {aeris.Collection}.

Event Payload:

  • model aeris.Model
  • collection aeris.Collection