new Model()

Description

Main object storing data model and emitting model events

Details

Members


<readonly> root :Group

Details

Methods


<static> defineModelProperties( obj, fields )

Description

Defines properties on an Node prototype with getter and setter.
Update events are emitted in the setter through root Model (if any).
The object must have a __ object, non enumerable property to store values.

Parameters
Name Type Description
obj function
fields Array.<string>
Details

off( type [, cb ] ) → {Model}

Description

Removes an event listener from the model

Parameters
Name Type Attributes Description
type string
cb function <optional>
Returns
Details

on( type, cb ) → {Model}

Description

Attaches an event listener on the model

Parameters
Name Type Description
type string
cb function
Returns
Details

once( type, cb ) → {Model}

Description

Attaches an event listener called once on the model

Parameters
Name Type Description
type string
cb function
Returns
Details

trigger( type ) → {$.Event}

Description

Triggers an event on the model

Parameters
Name Type Description
type string
Returns
Details

Type Definitions


GroupIteratee( node ) → {boolean}

Parameters
Name Type Description
node Node
Returns

stop the iteration

Details
function

Events


model:add

Description

After a node of the model has been added

Parameters
Name Type Description
parent Node
node Node
index int
Details

model:drop

Description

After a node of the model has been removed

Parameters
Name Type Description
node Node
Details

model:move

Description

After a node of the model has been moved

Parameters
Name Type Description
node Node
target Node
index int
Details

model:update

Description

After a value of the model changed

Parameters
Name Type Description
node Node
field string
value *
previousValue *
Details