Model

Model

new Model(attributes, optionsopt)

Source:
Mixes In:
Author:
  • kent.willis@vecna.com
See:

Generic Model

Parameters:
Name Type Attributes Default Description
attributes Object

the initial attributes to use for this model.

options Object <optional>
{}

the options for setting up this model.

Properties
Name Type Attributes Default Description
register boolean <optional>
false

whether to register this model in the app-level registry.
By default this will NOT add it to the registry unless set to true because
we have not mechanism that will make sure the models get removed from the registry
at the appropriate times.

Extends

Members

pollTimeoutId

Source:
Mixes In:
Properties:
Name Type Description
pollTimeoutId number

The id from when setTimeout was called to start polling.

Methods

_dispose()

Source:
Mixes In:

Dispose hook meant to be used by prototypes that extend this one that need to provide their own dispose logic.

dispose()

Source:
Mixes In:

Default dispose for model-like objects (Models, Cells, and ServiceCells).
Removes listeners and calls out to _dispose() for child specific dispose logic.
Triggers 2 events - "before-dispose" and "after-dispose".

isPolling()

Source:
Mixes In:

Returns true if the poll is active

polledFetch()

Source:
Mixes In:

By default, the polled fetching operation is routed directly
to backbone's fetch all.

startPolling(pollInterval)

Source:
Mixes In:

Starts polling Model/Collection by calling fetch every pollInterval.
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.

Parameters:
Name Type Description
pollInterval Integer

interval between each poll in ms.

stopPolling()

Source:
Mixes In:

Stops polling Model and clears all Timeouts.