View on GitHub

backbone-torso

A holistic approach to Backbone applications

Classes

Behavior
CellBackbone-Model
CollectionBackbone-Collection
EventsBackbone-Events
FormModelNestedModel
FormViewView
ListViewView
ListView
ModelBackbone-Model
NestedCellNestedModel
NestedModelBackbone-NestedModel
RouterBackbone-Router
ServiceCellCell
ViewStateCellNestedCell
ViewStateCell
ViewBackbone-View

View

historyBackbone-History
registryBackbone-Events
DataBehaviorBehavior
PrivateCollectionCollection

Mixins

validationMixin

Contains the methods that are mixed in on the model when binding

cacheMixin

Custom additions to the Backbone Collection object.

  • safe disposal methods for memory + event management
  • special functional overrides to support ID registration for different views
cellMixin

An non-persistable object that can listen to and emit events like a models.

loadingMixin

Loading logic.

modelMixin

The base for a model

pollingMixin

Periodic Polling Object to be mixed into Backbone Collections and Models.

The polling functionality should only be used for collections and for models that are not
part of any collections. It should not be used for a model that is a part of a collection.

Objects

HandlebarsHelper : object
templateRenderer : object

Static Template Engine.
All template renders should be piped through this method.

torso : object

Module containing all dependencies that exports a single object with everything attached (same format as the global).

Validation : object

Validation object containing validation mixin.

Functions

handlebarsUtils(Handlebars)

Extensions to handlebars helpers.

Adds additonal helpers to [Handlebars](#external_Handlebars)

stickitUtils()

Extensions to stickit handlers.

External

Backbone-CollectionBackbone-Events

The backbone Collection reference

Backbone-Events

The backbone Events reference

Backbone-ModelBackbone-Events

The backbone Model reference

Backbone-NestedModelBackbone-Model

The Backbone-Nested reference

Backbone-RouterBackbone-Events

The backbone Router reference

Backbone-ViewBackbone-Events

The backbone View reference

Handlebars

The handlebars reference

Handlebars-Template

The handlebars Template reference

Backbone-HistoryBackbone-Events

The backbone History reference

jQuery

The jQuery reference

jQuery-Deferred

The jQuery Deferred reference

Backbone

The backbone View reference

Behavior

Kind: global class
See: Behavior Annotated Source
Author: deena.wang@vecna.com

new Behavior(behaviorAttributes, behaviorOptions, [viewOptions])

Allows abstraction of common view logic into separate object

Param Type Description
behaviorAttributes Object <p>the initial value of the behavior’s attributes.</p>
behaviorOptions Object  
behaviorOptions.view Backbone-View <p>that Behavior is attached to</p>
behaviorOptions.alias string <p>the alias for the behavior in this view.</p>
[viewOptions] Object <p>options passed to View’s initialize</p>

behavior.alias : string

Unique name of the behavior instance w/in a view. More human readable than the cid.

Kind: instance property of Behavior

behavior.cidPrefix : string

cidPrefix of Behaviors

Kind: instance property of Behavior

behavior.mixin : Object

Add functions to be added to the view's public API. They will be behavior-scoped.

Kind: instance property of Behavior

behavior.prepare() ⇒ Object

The behavior's prepare result will be combined with the view's prepare with the behavior's alias as the namespace.
effectively: { [behaviorName]: behavior.prepare() } will be combined with the view's prepare result.

Kind: instance method of Behavior
Returns: Object - <p>a prepare context suitable to being added to the view’s prepare result.</p>

behavior._dispose()

Method to be invoked when dispose is called. By default calling dispose will remove the
behavior's on's and listenTo's.
Override this method to destruct any extra

Kind: instance method of Behavior

behavior.isDisposed() ⇒ boolean

Kind: instance method of Behavior
Returns: boolean - <p>true if the view was disposed</p>

Cell ⇐ Backbone-Model

Kind: global class
Extends: Backbone-Model
Mixes: cellMixin
See: Cell Annotated Source
Author: ariel.wexler@vecna.com, kent.willis@vecna.com

new Cell(attributes, [options])

An non-persistable object that can listen to and emit events like a models.

Param Type Default Description
attributes Object   <p>the initial attributes to use for this cell.</p>
[options] Object {} <p>the options for setting up this cell.</p>
[options.register] boolean false <p>whether to register this cell 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 cells get removed from the registry
at the appropriate times.</p>

cell.isModelCompatible

Whether a cell can pass as a model or not.
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invoked

Kind: instance property of Cell
Mixes: isModelCompatible
Default: false
Properties

Name Type
isModelCompatible boolean

cell.save()

Override and disable the save function

Kind: instance method of Cell
Mixes: save

cell.fetch()

Override and disable the fetch function

Kind: instance method of Cell
Mixes: fetch

cell.sync()

Override and disable the sync function

Kind: instance method of Cell
Mixes: sync

cell.url()

Override and disable the url

Kind: instance method of Cell
Mixes: url

Collection ⇐ Backbone-Collection

Kind: global class
Extends: Backbone-Collection
Mixes: pollingMixin, loadingMixin, cacheMixin
See: Collection Annotated Source
Author: kent.willis@vecna.com

new Collection()

Generic Collection

collection.pollTimeoutId

Kind: instance property of Collection
Mixes: pollTimeoutId
Properties

Name Type Description
pollTimeoutId number <p>The id from when setTimeout was called to start polling.</p>

collection.filterDefault() ⇒ Collection

The default filter. Always returns itself.

Kind: instance method of Collection
Returns: Collection - <p>a new instance of this collection</p>

collection.dispose()

Will abolish all listeners and events that are hooked
to this collection.

Kind: instance method of Collection

collection.isPolling()

Returns true if the poll is active

Kind: instance method of Collection
Mixes: isPolling

collection.startPolling(pollInterval)

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.

Kind: instance method of Collection
Mixes: startPolling

Param Type Description
pollInterval Integer <p>interval between each poll in ms.</p>

collection.stopPolling()

Stops polling Model and clears all Timeouts.

Kind: instance method of Collection
Mixes: stopPolling

collection.polledFetch()

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

Kind: instance method of Collection
Mixes: polledFetch

collection.constructor([options])

The constructor constructor / initialize method for collections.
Allocate new memory for the local references if they
were null when this method was called.

Kind: instance method of Collection
Mixes: constructor

Param Type Default Description
[options] Object   <p>optional options object</p>
[options.fetchHttpAction] string "'POST'" <p>http action used to get objects by ids</p>
[options.getByIdsUrl] string "'/ids'" <p>path appended to collection.url to get objects by a list of ids</p>
[options.fetchUsingTrackedIds] boolean true <p>if set to false, cache.fetch() will not pass to fetchByIds with current tracked ids
but will rather call the default fetch method.</p>

collection.hasLoadedOnce() ⇒ boolean

Kind: instance method of Collection
Mixes: hasLoadedOnce
Returns: boolean - <p>true if this model/collection has ever loaded from a fetch call</p>

collection.isLoading() ⇒ boolean

Kind: instance method of Collection
Mixes: isLoading
Returns: boolean - <p>true if this model/collection is currently loading new values from the server</p>

collection.getLoadedOncePromise() ⇒ Promise

Kind: instance method of Collection
Mixes: getLoadedOncePromise
Returns: Promise - <p>a promise that will resolve when the model/collection has loaded for the first time</p>

collection.fetch(options)

Overrides the base fetch call if this.fetchUsingTrackedIds is true
Calling fetch from the cache will fetch the tracked ids if fetchUsingTrackedIds is set to true, otherwise
it will pass through to the default fetch.

Kind: instance method of Collection
Mixes: fetch

Param Type
options Object

collection.getRequesterIds(the) ⇒ Array

Kind: instance method of Collection
Mixes: getRequesterIds
Returns: Array - <p>an array of the ids the requester with the guid has requested</p>

Param Type Description
the string <p>global unique id of the requester</p>

collection.getRequesterIdsAsDictionary(guid) ⇒ Object

This method is used for quick look up of a certain id within the list of requested ids

Kind: instance method of Collection
Mixes: getRequesterIdsAsDictionary
Returns: Object - <p>an dictionary of id -> id of the requester ids for a given requester.</p>

Param Type Description
guid string <p>the global unique id of the requester</p>

collection.removeRequester(guid)

Removes a requester from this cache. No longer receives updates

Kind: instance method of Collection
Mixes: removeRequester

Param Type Description
guid string <p>the global unique id of the requester</p>

collection.getRequesters() ⇒ Array

NOTE: this methods returns only the guids for requester collections that are currently tracking ids
TODO: should this return just the knownPrivateCollections

Kind: instance method of Collection
Mixes: getRequesters
Returns: Array - <p>an array of the all requesters in the form of their GUID’s</p>

collection.getAllRequestedIds() ⇒ Array

Return the list of Ids requested by this collection

Kind: instance method of Collection
Mixes: getAllRequestedIds
Returns: Array - <p>the corresponding requested Ids</p>

collection.createPrivateCollection(guid) ⇒ PrivateCollection

Used to return a collection of desired models given the requester object.
Binds a custom "resized" event to the private collections.
Overrides the fetch method to call the parent collection's fetchByIds method.
Overrides the registerIds method to redirect to its parent collection.

Kind: instance method of Collection
Mixes: createPrivateCollection
Returns: PrivateCollection - <p>an new empty collection of the same type as "this"</p>

Param Type Description
guid string <p>Identifier for the requesting view</p>

collection.registerIds(newIds, guid)

Registers a list of Ids that a particular object cares about and pushes
any cached models its way.

This method intelligently updates the "_requestedIds" field to contain all unique
requests for Ids to be fetched. Furthermore, the "polledFetch" method
is overriden such that it no longer routes through Backbone's fetch all,
but rather a custom "fetchByIds" method.

Kind: instance method of Collection
Mixes: registerIds

Param Type Description
newIds Array <p>New ids to register under the requester</p>
guid string <p>The GUID of the object that wants the ids</p>

collection.fetchByIds([fetchByIdsOptions]) ⇒ Promise

A custom fetch operation to only fetch the requested Ids.

Kind: instance method of Collection
Mixes: fetchByIds
Returns: Promise - <p>the promise of the fetch</p>

Param Type Default Description
[fetchByIdsOptions]     <p>argument fetchByIdsOptions</p>
[fetchByIdsOptions.idsToFetch] Array collection.collectionTrackedIds <p>A list of request Ids, will default to current tracked ids</p>
[fetchByIdsOptions.setOptions] Object   <p>if a set is made, then the setOptions will be passed into the set method</p>

Events ⇐ Backbone-Events

Kind: global class
Extends: Backbone-Events
See: Events Annotated Source
Author: ariel.wexler@vecna.com, kent.willis@vecna.com

new Events()

Generic Events.

FormModel ⇐ NestedModel

Kind: global class
Extends: NestedModel
Mixes: validationMixin
See: FormModel Annotated Source
Author: kent.willis@vecna.com

new FormModel()

Generic Form Model

formModel.mapping : Object

Map from aliases (either model names or computed value names) to mappings.
Please refer to the documentation on the constructor about the form and options for this field.

Kind: instance property of FormModel
Properties

Name
mapping

formModel.models : Object

Map from model aliases to model instances.
Please refer to the documentation on the constructor about the form and options for this field.

Kind: instance property of FormModel
Properties

Name
models

formModel.pollTimeoutId

Kind: instance property of FormModel
Mixes: pollTimeoutId
Properties

Name Type Description
pollTimeoutId number <p>The id from when setTimeout was called to start polling.</p>

formModel.constructor([options])

Constructor the form model. Can take in attributes to set initially. These will override any pulled values from object models
on initialization. On initialization the object model's values will be pulled once.
For the options, here are needed definitions:
mapping: {
modelName: 'foo bar baz' // track a model by providing an alias for a name and a space seperated list of fields to track as a String
modelName2: true // to track all fields
... // can have many model mappings
computedName: {
modelName: 'taz raz', // mappings for models that will be used for this computed mapping.
... // can have many model mappings for a computed
pull: function(models) {}, // a callback that will be invoked when pulling data from the Object model. Passes in a map of model alias/name to shallow copies of fields being tracked on that model.
push: function(models) {} // a callback that will be invoked when pushing data to the Object model. Passes in a map of model alias/name to object model being tracked under that alias.
}
},
models: {
modelName: modelInstance, // optionally, provide a set of model instance to model name (aliases) to start tracking
modelName2: modelInstance2 // provide as many aliases to model instances as you'd like
}

Kind: instance method of FormModel

Param Type Default Description
[options] Object    
[options.mapping] Object   <p>map from aliases (either model names or computed value names) to mappings.
A model mapping can bind an alias to a space seperated list of fields to track as a String r the boolean true if it is mapping all the
fields. A computed mapping can bind an alias to a set of model mappings required for this computed value and both a pull and/or push method
that are used to compute different values to or from object model(s).</p>
[options.models] Object   <p>Because the options.mapping parameter only allows you to define the mappings to aliases, this options allows
you to bind model instances to aliases. Setting model instances to aliases are required to actually begin pulling/pushing values.</p>
[options.startUpdating] boolean false <p>set to true if you want to immediately set up listeners to update this form
model as the object model updates. You can always toggle this state with startUpdating() and stopUpdating().</p>
[options.validation] Object   <p>A Backbone.Validation plugin hash to dictate the validation rules</p>
[options.labels] Object   <p>A Backbone.Validation plugin hash to dictate the attribute labels</p>

formModel.getMapping(alias) ⇒

Kind: instance method of FormModel
Returns: <p>the mapping config for that alias</p>

Param Type Description
alias string <p>the alias of the mapping - either a model mapping or a computed mapping</p>

formModel.getMappings() ⇒

Kind: instance method of FormModel
Returns: <p>all the current mapping configs</p>

formModel.setMapping(alias, mapping, [models], [copy])

Define or redefine how the form model pull/pushes or otherwise tracks properties between an object model(s).
Examples:
this.setMapping('modelAlias', true, optional model instance);
this.setMapping('modelAlias, 'foo bar baz', optional model instance);
this.setMapping('computedAlias', {
model1: 'foo',
model2: 'bar',
push: function(models) {
models.model1.set('foo', this.get('foobar')[0]);
models.model2.set('bar', this.get('foobar')[1]);
},
pull: function(models) {
this.set('foobar', [models.model1.foo, models.model2.bar]);
},
}, optional model map)

Kind: instance method of FormModel

Param Type Default Description
alias string   <p>the name for the mapping - either a model mapping or a computed mapping</p>
mapping string | boolean | Object   <p>Provides the mapping for this alias. If trying to map to a model, then either provide
a space delimited list of fields to track as a String or the boolean true to track all the model’s fields. If the mapping is for
a computed value, then provide a map from model alias to model mapping for all the fields needed for the computed and a pull method
if you want to change/combine/split object model properties before bringing them into the form model and a push method if you want to
change/combine/split form model properties before pushing them to the object models.</p>
[models] Object | Backbone-Model   <p>Provides instances to use for this mapping. If mapping is a computed,
provide a map from alias to model instance. If mapping is for a single model, just provide the model instance for that alias.</p>
[copy]   false <p>if true, will pull values definined by this mapping after setting the mapping. Requires models to be passed in.</p>

formModel.setMappings(mappings, [models], [copy])

Sets multiple mappings (both model mappings and computed value mappings) with one call.
Uses the same style of mapping syntax as the constructor. Please refer to the documentation on the constructor.
Here is an example:
this.setMappings({
model1: 'foo bar',
model2: 'baz',
ssn: {
model1: 'ssn',
model2: 'lastssn'
push: function(models) {},
pull: function(models) {},
}
}, optional model map)

Kind: instance method of FormModel

Param Type Default Description
mappings Object   <p>Uses the same style of mapping syntax as the constructor. Please refer to the documentation on the constructor.</p>
[models] Object   <p>this parameter allows you to immediately bind model instances to aliases. Keys are aliases and values are external:Backbone-Models.</p>
[copy]   false <p>if true, will pull values definined by this mapping after setting the mapping. Requires models to be passed in.</p>

formModel.unsetMapping(aliasOrModel, [removeModelIfUntracked])

Remove a mapping (model or computed) by alias

Kind: instance method of FormModel

Param Type Default Description
aliasOrModel string | Backbone-Model   <p>if a String is provided, it will unset the mapping with that alias.
If a external:Backbone-Model is provided, it will remove the model mapping that was bound to that model.</p>
[removeModelIfUntracked] boolean false <p>If true, after the mapping is removed, the model will also be unset but only if
no other mappings reference it. Note, setting this to true will not remove any computed mappings that also use that model.</p>

formModel.unsetMappings()

Removes all current mappings
Does NOT remove current model being tracked. Call this.untrackModels afterwards if you wish this behavior.

Kind: instance method of FormModel

formModel.getTrackedModel(alias) ⇒ Backbone-Model

Returns the object model currently bound to the given name/alias.

Kind: instance method of FormModel
Returns: Backbone-Model - <p>the model currently bound to the alias</p>

Param Type Description
alias string <p>the name/alias used by the mappings.</p>

formModel.getTrackedModels() ⇒

Returns all the currently tracked object models

Kind: instance method of FormModel
Returns: <p>all the currently tracked object models</p>

formModel.setTrackedModel()

Deprecated

Use [trackModel](#FormModel+trackModel) instead.

Kind: instance method of FormModel
See: trackModel

formModel.trackModel(alias, model, [copy])

Update or create a binding between an object model and an alias.

Kind: instance method of FormModel

Param Type Default Description
alias string   <p>the alias/name to bind to.</p>
model Backbone-Model   <p>the model to be bound. Mappings referencing this alias will start applying to this model.</p>
[copy] boolean false <p>if true, the form model will perform a pull on any mappings using this alias.</p>

formModel.setTrackedModels()

Deprecated

Use [trackModels](#FormModel+trackModels) instead.

Kind: instance method of FormModel
See: trackModels

formModel.trackModels(models, [copy])

Binds multiple models to their aliases.

Kind: instance method of FormModel

Param Type Default Description
models Object.<string, external:Backbone-Model>   <p>A map from alias/name to model to be bound to that alias.</p>
[copy] boolean false <p>if true, the form model will perform a pull on any mapping using these models.</p>

formModel.unsetTrackedModel()

Deprecated

Use [untrackModel](#FormModel+untrackModel) instead.

Kind: instance method of FormModel
See: untrackModel

formModel.untrackModel(aliasOrModel)

Removes the binding between a model alias and a model instance. Effectively stops tracking that model.

Kind: instance method of FormModel

Param Type Description
aliasOrModel string | Backbone-Model <p>If a string is given, it will unset the model using that alias. If a model instance
is given, it will unbind whatever alias is currently bound to it.</p>

formModel.unsetTrackedModels()

Deprecated

Use [untrackModels](#FormModel+untrackModels) instead.

Kind: instance method of FormModel
See: untrackModels

formModel.untrackModels()

Removes all the bindings between model aliases and model instances. Effectively stops tracking the current models.

Kind: instance method of FormModel

formModel.push()

Pushes values from this form model back to the object models it is tracking. This includes invoking the push callbacks from
computed values

Kind: instance method of FormModel

formModel.pull()

Pulls the most recent values of every object model that this form model tracks including computed values
NOTE: using this method can override user-submitted data from an HTML form. Use caution.

Kind: instance method of FormModel

formModel.save([options]) ⇒

If FormModel has a "url" property defined, it will invoke a save on the form model, and after successfully
saving, will perform a push.
If no "url" property is defined then the following behavior is used:
Pushes the form model values to the object models it is tracking and invokes save on each one. Returns a promise.
NOTE: if no url is specified and no models are being tracked, it will instead trigger a 'save-fail' event and reject the returned promise
with a payload that mimics a server response: {none: { success: false, response: [{ responseJSON: { generalReasons: [{messageKey: 'no.models.were.bound.to.form'}] }}] }}

Kind: instance method of FormModel
Returns: <p>when using a "url", a promise is returned for the save on this form model.
If not using a "url", a promise that will either resolve when all the models have successfully saved in which case the context returned
is an array of the responses (order determined by first the array of models and then the array of models used by
the computed values, normalized), or if any of the saves fail, the promise will be rejected with an array of responses.
Note: the size of the failure array will always be one - the first model that failed. This is a side-effect of $.when</p>

Param Type Default Description
[options] Object    
[options.rollback] boolean true <p>if true, when any object model fails to save, it will revert the object
model attributes to the state they were before calling save. NOTE: if there are updates that happen
to object models within the timing of this save method, the updates could be lost.</p>
[options.force] boolean true <p>if false, the form model will check to see if an update has been made
to any object models it is tracking since it’s last pull. If any stale data is found, save with throw an exception
with attributes: {name: ‘Stale data’, staleModels: [Array of model cid’s]}</p>

formModel.isTrackingAnyObjectModel() ⇒

Kind: instance method of FormModel
Returns: <p>true if this form model is backed by an Object model. That means that at least one object model was bound to an mapping alias.</p>

formModel.isUpdating() ⇒

Kind: instance method of FormModel
Returns: <p>true if any updates to an object model will immediately copy new values into this form model.</p>

formModel.startUpdating([pullFirst])

Will add listeners that will automatically pull new updates from this form's object models.

Kind: instance method of FormModel

Param Type Default Description
[pullFirst] boolean false <p>if true, the form model will pull most recent values then start listening</p>

formModel.stopUpdating()

This will stop the form model from listening to its object models.

Kind: instance method of FormModel

formModel.resetUpdating()

If updating, it will reset the updating events to match the current mappings.

Kind: instance method of FormModel

formModel.isModelStale(model, [staleModels], [currentHashValues]) ⇒ boolean

Kind: instance method of FormModel
Returns: boolean - <p>true if the model passed in has been changed since the last pull from the object model.</p>

Param Type Description
model Backbone.Model <p>the backbone model that is being checked</p>
[staleModels] Object <p>a hash that will be updated to contain this model if it is stale in the form: cid -> model.</p>
[currentHashValues] Object <p>If passed an object, it will look in this cache for the current value of the object model
instead of calculating it. It should be key’ed by the model’s cid</p>

formModel.checkIfModelsAreStale() ⇒ Array

Kind: instance method of FormModel
Returns: Array - <p>an array of the object models that have been updated since the last pull from this form model</p>

formModel.preValidate(attr, [value]) ⇒ undefined | string | Object

Check whether an attribute or a set of attributes are valid. It will default to use the model's current values but
you can pass in different values to use in the validation process instead.

Kind: instance method of FormModel
Mixes: preValidate
Returns: undefined | string | Object - <p>undefined if no errors, a validation exception if a single attribute, or an object with attribute name as key
and the error as the value</p>

Param Type Description
attr string | Object | Array.<string> <p>Either the name of the attribute, an array containing many attribute names, or
on object with attribute name to values</p>
[value] Any <p>a value to use for the attribute value instead of using the model’s value.</p>

formModel.isValid()

Check to see if an attribute, an array of attributes or the
entire model is valid. Passing true will force a validation
of the model.

Kind: instance method of FormModel
Mixes: isValid

formModel.validate()

This is called by Backbone when it needs to perform validation.
You can call it manually without any parameters to validate the
entire model.

Kind: instance method of FormModel
Mixes: validate

formModel.isPolling()

Returns true if the poll is active

Kind: instance method of FormModel
Mixes: isPolling

formModel.startPolling(pollInterval)

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.

Kind: instance method of FormModel
Mixes: startPolling

Param Type Description
pollInterval Integer <p>interval between each poll in ms.</p>

formModel.stopPolling()

Stops polling Model and clears all Timeouts.

Kind: instance method of FormModel
Mixes: stopPolling

formModel.polledFetch()

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

Kind: instance method of FormModel
Mixes: polledFetch

formModel.dispose()

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".

Kind: instance method of FormModel
Mixes: dispose

formModel._dispose()

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

Kind: instance method of FormModel
Mixes: \_dispose

FormView ⇐ View

Kind: global class
Extends: View
See: FormView Annotated Source
Author: ariel.wexler@vecna.com

new FormView(args)

Generic Form View

Param Type Default Description
args Object   <p>options argument</p>
[args.model] FormModel new this.FormModelClass() <p>a form model for binding that defaults to class-level
model or instantiates a FormModelClass</p>
[args.FormModelClass] function FormModel <p>the class (that extends FormModel) that will be used as the FormModel. Defaults to a class-level
definition or FormModel if none is provided</p>
[args.template] Handlebars-Template   <p>overrides the template used by this view</p>
[args.events] Object   <p>events hash: merge + override the events hash used by this view</p>
[args.fields] Object   <p>field hash: merge + override automated two-way binding field hash used by this view</p>
[args.bindings] Object   <p>binding hash: merge + override custom epoxy binding hash used by this view</p>

formView.template : Handlebars-Template

Handlebars template for form

Kind: instance property of FormView

formView.events : Object

Backbone events hash

Kind: instance property of FormView

formView.fields : Object

Two-way binding field customization

Kind: instance property of FormView

formView.bindings : Object

Stickit bindings hash

Kind: instance property of FormView

formView.FormModelClass : FormModel.prototype

The class to be used when instantiating the form model

Kind: instance property of FormView

formView.viewState : ViewStateCell

Cell that can be used to save state for rendering the view.

Kind: instance property of FormView

formView.prepare() ⇒ Object

Prepare the formview's default render context

Kind: instance method of FormView
Overrides: prepare
Returns: Object - <p>{Object.errors} A hash of field names mapped to error messages
{Object.success} A boolean value of true if validation has succeeded</p>

formView.delegateEvents()

Override the delegate events and wrap our custom additions

Kind: instance method of FormView
Overrides: delegateEvents

formView.resetModelListeners(model, [stopListening])

Resets the form model with the passed in model. Stops listening to current form model
and sets up listeners on the new one.

Kind: instance method of FormView

Param Type Default Description
model Torso.FormModel   <p>the new form model</p>
[stopListening] boolean false <p>if true, it will stop listening to the previous form model</p>

formView.valid()

Default method called on validation success.

Kind: instance method of FormView

formView.invalid()

Default method called on validation failure.

Kind: instance method of FormView

formView.deactivate()

Deactivate callback that removes bindings and other resources
that shouldn't exist in a dactivated state

Kind: instance method of FormView
Overrides: deactivate

formView.get()

Alias to this.viewState.get()

Kind: instance method of FormView

formView.set()

Alias to this.viewState.set()

Kind: instance method of FormView

formView.has()

Alias to this.viewState.has()

Kind: instance method of FormView

formView.unset()

Alias to this.viewState.unset()

Kind: instance method of FormView

formView.toJSON()

Alias to this.viewState.toJSON()

Kind: instance method of FormView

formView.getBehavior(alias) ⇒ Torso.Behavior

Kind: instance method of FormView
Returns: Torso.Behavior - <p>the behavior instance if one exists with that alias</p>

Param Type Description
alias string <p>the name/alias of the behavior</p>

formView._prepare(context) ⇒ Object

Extension point to augment the template context with custom content.

Kind: instance method of FormView
Returns: Object - <p>[Optional] If you return an object, it will be merged with the context</p>

Param Description
context <p>the context you can modify</p>

formView.render() ⇒ Promise

Rebuilds the html for this view's element. Should be able to be called at any time.
Defaults to using this.templateRender. Assumes that this.template is a javascript
function that accepted a single JSON context.
The render method returns a promise that resolves when rendering is complete. Typically render
is synchronous and the rendering is complete upon completion of the method. However, when utilizing
transitions/animations, the render process can be asynchronous and the promise is useful to know when it has finished.

Kind: instance method of FormView
Returns: Promise - <p>a promise that when resolved signifies that the rendering process is complete.</p>

formView.prerender() ⇒ Promise | Array.<Promise>

Hook during render that is invoked before any DOM rendering is performed.
This method can be overwritten as usual OR extended using .prototype.prerender.apply(this, arguments);
NOTE: if you require the view to be detached from the DOM, consider using _detach callback</p> **Kind**: instance method of [FormView](#FormView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, prerender is finished. Note: render logic will not wait until promises are resolved.

### formView.updateDOM()

Produces and sets this view's elements DOM. Used during the rendering process. Override if you have custom DOM update logic.
Defaults to using the stanrdard: this.templateRender(this.$el, this.template, this.prepare(), templateRendererOptions);
this.templateRendererOptions is an object or function defined on the view that is passed into the renderer.
Examples include: views with no template or multiple templates, or if you wish to use a different rendering engine than the templateRenderer or wish to pass options to it.

**Kind**: instance method of [FormView](#FormView) ### formView.updateClassName(newClassName)

Updates this view element's class attribute with the value provided.
If no value provided, removes the class attribute of this view element.

**Kind**: instance method of [FormView](#FormView) | Param | Type | Description | | --- | --- | --- | | newClassName | string |

the new value of the class attribute

| ### formView.postrender() ⇒ Promise \| Array.<Promise>

Hook during render that is invoked after all DOM rendering is done and tracked views attached.
This method can be overwritten as usual OR extended using .prototype.postrender.apply(this, arguments);
NOTE: if you require the view to be attached to the DOM, consider using _attach callback</p> **Kind**: instance method of [FormView](#FormView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, postrender is finished. Note: render logic will not wait until promises are resolved.

### formView.templateRender()

Hotswap rendering system reroute method.
See Torso.templateRenderer#render for params

**Kind**: instance method of [FormView](#FormView) ### formView.undelegateEvents()

Overrides undelegateEvents
Unbinds DOM events from the view.

**Kind**: instance method of [FormView](#FormView) ### formView.attachTo([$el], [options]) ⇒ Promise

If detached, will replace the element passed in with this view's element and activate the view.

**Kind**: instance method of [FormView](#FormView) **Returns**: Promise -

promise that when resolved, the attach process is complete. Normally this method is synchronous. Transition effects can
make it asynchronous.

| Param | Type | Default | Description | | --- | --- | --- | --- | | [$el] | [jQuery](#external_jQuery) | |

the element to attach to. This element will be replaced with this view.
If options.replaceMethod is provided, then this parameter is ignored.

| | [options] | Object | |

optional options

| | [options.replaceMethod] | Fucntion | |

if given, this view will invoke replaceMethod function
in order to attach the view's DOM to the parent instead of calling $el.replaceWith

| | [options.discardInjectionSite] | Booleon | false |

if set to true, the injection site is not saved.

| ### formView.attachView($el, view, [options]) ⇒ Promise

Registers the view as a tracked view (defaulting as a child view), then calls view.attachTo with the element argument
The element argument can be a String that references an element with the corresponding "inject" attribute.
When using attachView with options.useTransition:
Will inject a new view into an injection site by using the new view's transitionIn method. If the parent view
previously had another view at this injections site, this previous view will be removed with that view's transitionOut.
If this method is used within a render, the current views' injection sites will be cached so they can be transitioned out even
though they are detached in the process of re-rendering. If no previous view is given and none can be found, the new view is transitioned in regardless.
If the previous view is the same as the new view, it is injected normally without transitioning in.
The previous view must has used an injection site with the standard "inject=" attribute to be found.
When the transitionIn and transitionOut methods are invoked on the new and previous views, the options parameter will be passed on to them. Other fields
will be added to the options parameter to allow better handling of the transitions. These include:
{
newView: the new view
previousView: the previous view (can be undefined)
parentView: the parent view transitioning in or out the tracked view
}</p> **Kind**: instance method of [FormView](#FormView) **Returns**: Promise -

resolved when all transitions are complete. No payload is provided upon resolution. If no transitions, then returns a resolved promise.

| Param | Type | Default | Description | | --- | --- | --- | --- | | $el | [jQuery](#external_jQuery) \| string | |

the element to attach to OR the name of the injection site. The element with the attribute "inject=" will be used.</p> | | view | [View](#View) | |

The instantiated view object to be attached

| | [options] | Object | |

optionals options object. If using transitions, this options object will be passed on to the transitionIn and transitionOut methods as well.

| | [options.noActivate] | boolean | false |

if set to true, the view will not be activated upon attaching.

| | [options.shared] | boolean | false |

if set to true, the view will be treated as a shared view and not disposed during parent view disposing.

| | [options.useTransition] | boolean | false |

if set to true, this method will delegate attach logic to this.__transitionNewViewIntoSite

| | [options.addBefore] | boolean | false |

if true, and options.useTransition is true, the new view's element will be added before the previous view's element. Defaults to after.

| | [options.previousView] | [View](#View) | |

if using options.useTransition, then you can explicitly define the view that should be transitioned out.
If using transitions and no previousView is provided, it will look to see if a view already is at this injection site and uses that by default.

| ### formView.attachTrackedViews() ⇒ Promise \| Array.<Promise>

Hook to attach all your tracked views. This hook will be called after all DOM rendering is done so injection sites should be available.
This method can be overwritten as usual OR extended using .prototype.attachTrackedViews.apply(this, arguments);</p> **Kind**: instance method of [FormView](#FormView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, all tracked views are attached. Useful when using this.attachView with useTransition=true.

### formView.\_attached()

Method to be invoked when the view is fully attached to the DOM (NOT just the parent). Use this method to manipulate the view
after the DOM has been attached to the document. The default implementation is a no-op.

**Kind**: instance method of [FormView](#FormView) ### formView.isAttachedToParent() ⇒ boolean **Kind**: instance method of [FormView](#FormView) **Returns**: boolean -

true if the view is attached to a parent

### formView.isAttached() ⇒ boolean

NOTE: depends on a global variable "document"

**Kind**: instance method of [FormView](#FormView) **Returns**: boolean -

true if the view is attached to the DOM

### formView.detach()

If attached, will detach the view from the DOM.
This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach
callback on each tracked view recursively.

**Kind**: instance method of [FormView](#FormView) ### formView.detachTrackedViews([options])

Detach all tracked views or a subset of them based on the options parameter.
NOTE: this is not recursive - it will not separate the entire view tree.

**Kind**: instance method of [FormView](#FormView) | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, detach only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, detach only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### formView.\_detached()

Method to be invoked when the view is detached from the DOM (NOT just the parent). Use this method to clean up state
after the view has been removed from the document. The default implementation is a no-op.

**Kind**: instance method of [FormView](#FormView) ### formView.activate()

Resets listeners and events in order for the view to be reattached to the visible DOM

**Kind**: instance method of [FormView](#FormView) ### formView.\_activate()

Method to be invoked when activate is called. Use this method to turn on any
custom timers, listenTo's or on's that should be activatable. The default implementation is a no-op.

**Kind**: instance method of [FormView](#FormView) ### formView.isActive() ⇒ boolean **Kind**: instance method of [FormView](#FormView) **Returns**: boolean -

true if the view is active

### formView.\_deactivate()

Method to be invoked when deactivate is called. Use this method to turn off any
custom timers, listenTo's or on's that should be deactivatable. The default implementation is a no-op.

**Kind**: instance method of [FormView](#FormView) ### formView.dispose()

Removes all listeners, disposes children views, stops listening to events, removes DOM.
After dispose is called, the view can be safely garbage collected. Called while
recursively removing views from the hierarchy.

**Kind**: instance method of [FormView](#FormView) ### formView.\_dispose()

Method to be invoked when dispose is called. By default calling dispose will remove the
view's element, its on's, listenTo's, and any registered children.
Override this method to destruct any extra

**Kind**: instance method of [FormView](#FormView) ### formView.isDisposed() ⇒ boolean **Kind**: instance method of [FormView](#FormView) **Returns**: boolean -

true if the view was disposed

### formView.hasTrackedViews([options]) ⇒ boolean **Kind**: instance method of [FormView](#FormView) **Returns**: boolean -

true if this view has tracked views (limited by the options parameter)

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, only check the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, only check the child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### formView.getTrackedViews([options]) ⇒ [List.<View>](#View)

Returns all tracked views, both child views and shared views.

**Kind**: instance method of [FormView](#FormView) **Returns**: [List.<View>](#View) -

all tracked views (filtered by options parameter)

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, get only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, get only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### formView.getTrackedView(viewCID) ⇒ **Kind**: instance method of [FormView](#FormView) **Returns**:

the view with the given cid. Will look in both shared and child views.

| Param | Type | Description | | --- | --- | --- | | viewCID | string |

the cid of the view

| ### formView.registerTrackedView(view, [options]) ⇒ [View](#View)

Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will
be done to the tracked view as well. Except dispose for shared views. This method defaults to register the
view as a child view unless specified by options.shared.

**Kind**: instance method of [FormView](#FormView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Default | Description | | --- | --- | --- | --- | | view | [View](#View) | |

the tracked view

| | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, registers view as a shared view. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed. If false, registers view as a child view which are disposed when the parent is disposed.

| ### formView.unregisterTrackedView(view) ⇒ [View](#View)

Unbinds the tracked view - no recursive calls will be made to this shared view

**Kind**: instance method of [FormView](#FormView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Description | | --- | --- | --- | | view | [View](#View) |

the shared view

| ### formView.unregisterTrackedViews([options]) ⇒ [View](#View)

Unbinds all tracked view - no recursive calls will be made to this shared view
You can limit the types of views that will be unregistered by using the options parameter.

**Kind**: instance method of [FormView](#FormView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, unregister only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, unregister only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### formView.transitionOut(done, options)

Override to provide your own transition out logic. Default logic is to just detach from the page.
The method is passed a callback that should be invoked when the transition out has fully completed.

**Kind**: instance method of [FormView](#FormView) | Param | Type | Description | | --- | --- | --- | | done | function |

callback that MUST be invoked when the transition is complete.

| | options | |

optionals options object

| | options.currentView | [View](#View) |

the view that is being transitioned in.

| | options.previousView | [View](#View) |

the view that is being transitioned out. Typically this view.

| | options.parentView | [View](#View) |

the view that is invoking the transition.

| ### formView.transitionIn(attach, done, options)

Override to provide your own transition in logic. Default logic is to just attach to the page.
The method is passed a callback that should be invoked when the transition in has fully completed.

**Kind**: instance method of [FormView](#FormView) | Param | Type | Description | | --- | --- | --- | | attach | function |

callback to be invoked when you want this view to be attached to the dom.
If you are trying to transition in a tracked view, consider using this.transitionInView()

| | done | function |

callback that MUST be invoked when the transition is complete.

| | options | |

optionals options object

| | options.currentView | [View](#View) |

the view that is being transitioned in.

| | options.previousView | [View](#View) |

the view that is being transitioned out. Typically this view.

| | options.parentView | [View](#View) |

the view that is invoking the transition.

| ### formView.invokeFeedback(to, [evt], [indexMap])

Invokes a feedback entry's "then" method

**Kind**: instance method of [FormView](#FormView) | Param | Type | Description | | --- | --- | --- | | to | string |

the "to" field corresponding to the feedback entry to be invoked.

| | [evt] | Event |

the event to be passed to the "then" method

| | [indexMap] | Object |

a map from index variable name to index value. Needed for "to" fields with array notation.

| ## ListView ⇐ [View](#View) **Kind**: global class **Extends**: [View](#View) **See**: ListView Annotated Source **Author**: ariel.wexler@vecna.com, kent.willis@vecna.com * [ListView](#ListView) ⇐ [View](#View) * [new ListView()](#new_ListView_new) * [new constructor(args)](#new_ListView_new) * [.collection](#ListView+collection) : [Collection](#Collection) * [.itemView](#ListView+itemView) : [View](#View) \| function * [.template](#ListView+template) : [Handlebars-Template](#external_Handlebars-Template) * [.emptyTemplate](#ListView+emptyTemplate) : [Handlebars-Template](#external_Handlebars-Template) * [.itemContainer](#ListView+itemContainer) : String * [.viewState](#View+viewState) : [ViewStateCell](#ViewStateCell) * [.setCollection(collection, preventUpdate)](#ListView+setCollection) * [.updateDOM()](#ListView+updateDOM) * [.renderChildViews()](#ListView+renderChildViews) * [.reorder()](#ListView+reorder) * [.prepareEmpty()](#ListView+prepareEmpty) ⇒ * [.modelsToRender()](#ListView+modelsToRender) * [.update()](#ListView+update) * [.getItemViewFromModel(model)](#ListView+getItemViewFromModel) ⇒ * [.hasItemViews()](#ListView+hasItemViews) ⇒ boolean * [.getItemViews()](#ListView+getItemViews) ⇒ [Array.<View>](#View) * [.get()](#View+get) * [.set()](#View+set) * [.has()](#View+has) * [.unset()](#View+unset) * [.toJSON()](#View+toJSON) * [.getBehavior(alias)](#View+getBehavior) ⇒ Torso.Behavior * [.prepare()](#View+prepare) ⇒ Object * [._prepare(context)](#View+_prepare) ⇒ Object * [.render()](#View+render) ⇒ Promise * [.prerender()](#View+prerender) ⇒ Promise \| Array.<Promise> * [.updateClassName(newClassName)](#View+updateClassName) * [.postrender()](#View+postrender) ⇒ Promise \| Array.<Promise> * [.templateRender()](#View+templateRender) * [.delegateEvents()](#View+delegateEvents) * [.undelegateEvents()](#View+undelegateEvents) * [.attachTo([$el], [options])](#View+attachTo) ⇒ Promise * [.attachView($el, view, [options])](#View+attachView) ⇒ Promise * [.attachTrackedViews()](#View+attachTrackedViews) ⇒ Promise \| Array.<Promise> * [._attached()](#View+_attached) * [.isAttachedToParent()](#View+isAttachedToParent) ⇒ boolean * [.isAttached()](#View+isAttached) ⇒ boolean * [.detach()](#View+detach) * [.detachTrackedViews([options])](#View+detachTrackedViews) * [._detached()](#View+_detached) * [.activate()](#View+activate) * [._activate()](#View+_activate) * [.isActive()](#View+isActive) ⇒ boolean * [.deactivate()](#View+deactivate) * [._deactivate()](#View+_deactivate) * [.dispose()](#View+dispose) * [._dispose()](#View+_dispose) * [.isDisposed()](#View+isDisposed) ⇒ boolean * [.hasTrackedViews([options])](#View+hasTrackedViews) ⇒ boolean * [.getTrackedViews([options])](#View+getTrackedViews) ⇒ [List.<View>](#View) * [.getTrackedView(viewCID)](#View+getTrackedView) ⇒ * [.registerTrackedView(view, [options])](#View+registerTrackedView) ⇒ [View](#View) * [.unregisterTrackedView(view)](#View+unregisterTrackedView) ⇒ [View](#View) * [.unregisterTrackedViews([options])](#View+unregisterTrackedViews) ⇒ [View](#View) * [.transitionOut(done, options)](#View+transitionOut) * [.transitionIn(attach, done, options)](#View+transitionIn) * [.invokeFeedback(to, [evt], [indexMap])](#View+invokeFeedback) ### new ListView()

A view that is backed by a collection that managers views per model in the collection.

### new constructor(args)

Constructor for the list view object.

| Param | Type | Default | Description | | --- | --- | --- | --- | | args | Object | |

options argument

| | args.itemView | [Backbone-View](#external_Backbone-View) \| function | |

the class definition of the item view. This view will be instantiated for every model returned by modelsToRender(). If a function is passed in, then for each model, this function will be invoked to find the appropriate view class. It takes the model as the only parameter.

| | args.collection | [Backbone-Collection](#external_Backbone-Collection) | |

The collection that will back this list view. A subclass of list view might provide a default collection. Can be private or public collection

| | [args.itemContext] | Object \| function | |

object or function that's passed to the item view's during initialization under the name "context". Can be used by the item view during their prepare method.

| | [args.template] | [Handlebars-Template](#external_Handlebars-Template) | |

allows a list view to hold it's own HTML like filter buttons, etc.

| | [args.itemContainer] | string | |

(Required if 'template' is provided, ignored otherwise) name of injection site for list of item views

| | [args.emptyTemplate] | [Handlebars-Template](#external_Handlebars-Template) | |

if provided, this template will be shown if the modelsToRender() method returns an empty list. If a itemContainer is provided, the empty template will be rendered there.

| | [args.modelsToRender] | function | |

If provided, this function will override the modelsToRender() method with custom functionality.

| | [args.renderWait] | number | 0 |

If provided, will collect any internally invoked renders (typically through collection events like reset) for a duration specified by renderWait in milliseconds and then calls a single render instead. Helps to remove unnecessary render calls when modifying the collection often.

| | [args.modelId] | string | "'cid'" |

one of ('cid' or 'id'): model property used as identifier for a given model. This property is saved and used to find the corresponding view.

| | [args.modelName] | string | "'model'" |

name of the model argument passed to the item view during initialization

| ### listView.collection : [Collection](#Collection)

The collection that holds the models that this list view will track

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | collection | ### listView.itemView : [View](#View) \| function

The item view class definition that will be instantiated for each model in the list.
itemView can also be a function that takes a model and returns a view class. This allows
for different view classes depending on the model.

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | itemView | ### listView.template : [Handlebars-Template](#external_Handlebars-Template)

The template that allows a list view to hold it's own HTML like filter buttons, etc.

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | template | ### listView.emptyTemplate : [Handlebars-Template](#external_Handlebars-Template)

If provided, this template that will be shown if the modelsToRender() method returns
an empty list. If an itemContainer is provided, the empty template will be rendered there.

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | emptyTemplate | ### listView.itemContainer : String

(Required if 'template' is provided, ignored otherwise) name of injection site for list of item views

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | itemContainer | ### listView.viewState : [ViewStateCell](#ViewStateCell)

Cell that can be used to save state for rendering the view.

**Kind**: instance property of [ListView](#ListView) ### listView.setCollection(collection, preventUpdate)

Sets the collection from which this view generates item views.
This method will attach all necessary event listeners to the new collection to auto-generate item views
and has the option of removing listeners on a previous collection. It will immediately update child
views and re-render if it is necessary - this behavior can be prevented with preventUpdate argument

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | collection | [Backbone-Collection](#external_Backbone-Collection) |

the new collection that this list view should use.

| | preventUpdate | boolean |

if true, the list view will not update the child views nor rerender.

| ### listView.updateDOM()

Builds a single DOM fragment from the item views and attaches it at once.

**Kind**: instance method of [ListView](#ListView) **Overrides**: [updateDOM](#View+updateDOM) ### listView.renderChildViews()

Loops through children views and renders them

**Kind**: instance method of [ListView](#ListView) ### listView.reorder()

Takes existing item views and moves them into correct order defined by
this.modelsToRender(). NOTE: As this method doesn't generate or remove views,
this method takes advantage of jquery's ability to move elements already attached to the DOM.

**Kind**: instance method of [ListView](#ListView) ### listView.prepareEmpty() ⇒

Override if you want a different context for your empty template. Defaults to this.prepare()

**Kind**: instance method of [ListView](#ListView) **Returns**:

a context that can be used by the empty list template

### listView.modelsToRender()

Returns an array of which models should be rendered.
By default, all models in the input collection will be
shown. Extensions of this class may override this
method to apply collection filters.

**Kind**: instance method of [ListView](#ListView) ### listView.update()

Builds any new views, removes stale ones, and re-renders

**Kind**: instance method of [ListView](#ListView) ### listView.getItemViewFromModel(model) ⇒

Returns the view that corresponds to the model if one exists

**Kind**: instance method of [ListView](#ListView) **Returns**:

the item view corresponding to the model

| Param | Type | Description | | --- | --- | --- | | model | [Model](#Model) |

the model

| ### listView.hasItemViews() ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

returns true if there exists any generated item views

### listView.getItemViews() ⇒ [Array.<View>](#View) **Kind**: instance method of [ListView](#ListView) **Returns**: [Array.<View>](#View) -

Returns unordered list of views generated by this list view

### listView.get()

Alias to this.viewState.get()

**Kind**: instance method of [ListView](#ListView) ### listView.set()

Alias to this.viewState.set()

**Kind**: instance method of [ListView](#ListView) ### listView.has()

Alias to this.viewState.has()

**Kind**: instance method of [ListView](#ListView) ### listView.unset()

Alias to this.viewState.unset()

**Kind**: instance method of [ListView](#ListView) ### listView.toJSON()

Alias to this.viewState.toJSON()

**Kind**: instance method of [ListView](#ListView) ### listView.getBehavior(alias) ⇒ Torso.Behavior **Kind**: instance method of [ListView](#ListView) **Returns**: Torso.Behavior -

the behavior instance if one exists with that alias

| Param | Type | Description | | --- | --- | --- | | alias | string |

the name/alias of the behavior

| ### listView.prepare() ⇒ Object

prepareFields can be used to augment the default render method contents.
See __getPrepareFieldsContext() for more details on how to configure them.

**Kind**: instance method of [ListView](#ListView) **Returns**: Object -

context for a render method. Defaults to:
{view: this.viewState.toJSON(), model: this.model.toJSON()}

### listView.\_prepare(context) ⇒ Object

Extension point to augment the template context with custom content.

**Kind**: instance method of [ListView](#ListView) **Returns**: Object -

[Optional] If you return an object, it will be merged with the context

| Param | Description | | --- | --- | | context |

the context you can modify

| ### listView.render() ⇒ Promise

Rebuilds the html for this view's element. Should be able to be called at any time.
Defaults to using this.templateRender. Assumes that this.template is a javascript
function that accepted a single JSON context.
The render method returns a promise that resolves when rendering is complete. Typically render
is synchronous and the rendering is complete upon completion of the method. However, when utilizing
transitions/animations, the render process can be asynchronous and the promise is useful to know when it has finished.

**Kind**: instance method of [ListView](#ListView) **Returns**: Promise -

a promise that when resolved signifies that the rendering process is complete.

### listView.prerender() ⇒ Promise \| Array.<Promise>

Hook during render that is invoked before any DOM rendering is performed.
This method can be overwritten as usual OR extended using .prototype.prerender.apply(this, arguments);
NOTE: if you require the view to be detached from the DOM, consider using _detach callback</p> **Kind**: instance method of [ListView](#ListView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, prerender is finished. Note: render logic will not wait until promises are resolved.

### listView.updateClassName(newClassName)

Updates this view element's class attribute with the value provided.
If no value provided, removes the class attribute of this view element.

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | newClassName | string |

the new value of the class attribute

| ### listView.postrender() ⇒ Promise \| Array.<Promise>

Hook during render that is invoked after all DOM rendering is done and tracked views attached.
This method can be overwritten as usual OR extended using .prototype.postrender.apply(this, arguments);
NOTE: if you require the view to be attached to the DOM, consider using _attach callback</p> **Kind**: instance method of [ListView](#ListView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, postrender is finished. Note: render logic will not wait until promises are resolved.

### listView.templateRender()

Hotswap rendering system reroute method.
See Torso.templateRenderer#render for params

**Kind**: instance method of [ListView](#ListView) ### listView.delegateEvents()

Overrides the base delegateEvents
Binds DOM events with the view using events hash while also adding feedback event bindings

**Kind**: instance method of [ListView](#ListView) ### listView.undelegateEvents()

Overrides undelegateEvents
Unbinds DOM events from the view.

**Kind**: instance method of [ListView](#ListView) ### listView.attachTo([$el], [options]) ⇒ Promise

If detached, will replace the element passed in with this view's element and activate the view.

**Kind**: instance method of [ListView](#ListView) **Returns**: Promise -

promise that when resolved, the attach process is complete. Normally this method is synchronous. Transition effects can
make it asynchronous.

| Param | Type | Default | Description | | --- | --- | --- | --- | | [$el] | [jQuery](#external_jQuery) | |

the element to attach to. This element will be replaced with this view.
If options.replaceMethod is provided, then this parameter is ignored.

| | [options] | Object | |

optional options

| | [options.replaceMethod] | Fucntion | |

if given, this view will invoke replaceMethod function
in order to attach the view's DOM to the parent instead of calling $el.replaceWith

| | [options.discardInjectionSite] | Booleon | false |

if set to true, the injection site is not saved.

| ### listView.attachView($el, view, [options]) ⇒ Promise

Registers the view as a tracked view (defaulting as a child view), then calls view.attachTo with the element argument
The element argument can be a String that references an element with the corresponding "inject" attribute.
When using attachView with options.useTransition:
Will inject a new view into an injection site by using the new view's transitionIn method. If the parent view
previously had another view at this injections site, this previous view will be removed with that view's transitionOut.
If this method is used within a render, the current views' injection sites will be cached so they can be transitioned out even
though they are detached in the process of re-rendering. If no previous view is given and none can be found, the new view is transitioned in regardless.
If the previous view is the same as the new view, it is injected normally without transitioning in.
The previous view must has used an injection site with the standard "inject=" attribute to be found.
When the transitionIn and transitionOut methods are invoked on the new and previous views, the options parameter will be passed on to them. Other fields
will be added to the options parameter to allow better handling of the transitions. These include:
{
newView: the new view
previousView: the previous view (can be undefined)
parentView: the parent view transitioning in or out the tracked view
}</p> **Kind**: instance method of [ListView](#ListView) **Returns**: Promise -

resolved when all transitions are complete. No payload is provided upon resolution. If no transitions, then returns a resolved promise.

| Param | Type | Default | Description | | --- | --- | --- | --- | | $el | [jQuery](#external_jQuery) \| string | |

the element to attach to OR the name of the injection site. The element with the attribute "inject=" will be used.</p> | | view | [View](#View) | |

The instantiated view object to be attached

| | [options] | Object | |

optionals options object. If using transitions, this options object will be passed on to the transitionIn and transitionOut methods as well.

| | [options.noActivate] | boolean | false |

if set to true, the view will not be activated upon attaching.

| | [options.shared] | boolean | false |

if set to true, the view will be treated as a shared view and not disposed during parent view disposing.

| | [options.useTransition] | boolean | false |

if set to true, this method will delegate attach logic to this.__transitionNewViewIntoSite

| | [options.addBefore] | boolean | false |

if true, and options.useTransition is true, the new view's element will be added before the previous view's element. Defaults to after.

| | [options.previousView] | [View](#View) | |

if using options.useTransition, then you can explicitly define the view that should be transitioned out.
If using transitions and no previousView is provided, it will look to see if a view already is at this injection site and uses that by default.

| ### listView.attachTrackedViews() ⇒ Promise \| Array.<Promise>

Hook to attach all your tracked views. This hook will be called after all DOM rendering is done so injection sites should be available.
This method can be overwritten as usual OR extended using .prototype.attachTrackedViews.apply(this, arguments);</p> **Kind**: instance method of [ListView](#ListView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, all tracked views are attached. Useful when using this.attachView with useTransition=true.

### listView.\_attached()

Method to be invoked when the view is fully attached to the DOM (NOT just the parent). Use this method to manipulate the view
after the DOM has been attached to the document. The default implementation is a no-op.

**Kind**: instance method of [ListView](#ListView) ### listView.isAttachedToParent() ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if the view is attached to a parent

### listView.isAttached() ⇒ boolean

NOTE: depends on a global variable "document"

**Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if the view is attached to the DOM

### listView.detach()

If attached, will detach the view from the DOM.
This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach
callback on each tracked view recursively.

**Kind**: instance method of [ListView](#ListView) ### listView.detachTrackedViews([options])

Detach all tracked views or a subset of them based on the options parameter.
NOTE: this is not recursive - it will not separate the entire view tree.

**Kind**: instance method of [ListView](#ListView) | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, detach only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, detach only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### listView.\_detached()

Method to be invoked when the view is detached from the DOM (NOT just the parent). Use this method to clean up state
after the view has been removed from the document. The default implementation is a no-op.

**Kind**: instance method of [ListView](#ListView) ### listView.activate()

Resets listeners and events in order for the view to be reattached to the visible DOM

**Kind**: instance method of [ListView](#ListView) ### listView.\_activate()

Method to be invoked when activate is called. Use this method to turn on any
custom timers, listenTo's or on's that should be activatable. The default implementation is a no-op.

**Kind**: instance method of [ListView](#ListView) ### listView.isActive() ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if the view is active

### listView.deactivate()

Maintains view state and DOM but prevents view from becoming a zombie by removing listeners
and events that may affect user experience. Recursively invokes deactivate on child views

**Kind**: instance method of [ListView](#ListView) ### listView.\_deactivate()

Method to be invoked when deactivate is called. Use this method to turn off any
custom timers, listenTo's or on's that should be deactivatable. The default implementation is a no-op.

**Kind**: instance method of [ListView](#ListView) ### listView.dispose()

Removes all listeners, disposes children views, stops listening to events, removes DOM.
After dispose is called, the view can be safely garbage collected. Called while
recursively removing views from the hierarchy.

**Kind**: instance method of [ListView](#ListView) ### listView.\_dispose()

Method to be invoked when dispose is called. By default calling dispose will remove the
view's element, its on's, listenTo's, and any registered children.
Override this method to destruct any extra

**Kind**: instance method of [ListView](#ListView) ### listView.isDisposed() ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if the view was disposed

### listView.hasTrackedViews([options]) ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if this view has tracked views (limited by the options parameter)

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, only check the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, only check the child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### listView.getTrackedViews([options]) ⇒ [List.<View>](#View)

Returns all tracked views, both child views and shared views.

**Kind**: instance method of [ListView](#ListView) **Returns**: [List.<View>](#View) -

all tracked views (filtered by options parameter)

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, get only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, get only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### listView.getTrackedView(viewCID) ⇒ **Kind**: instance method of [ListView](#ListView) **Returns**:

the view with the given cid. Will look in both shared and child views.

| Param | Type | Description | | --- | --- | --- | | viewCID | string |

the cid of the view

| ### listView.registerTrackedView(view, [options]) ⇒ [View](#View)

Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will
be done to the tracked view as well. Except dispose for shared views. This method defaults to register the
view as a child view unless specified by options.shared.

**Kind**: instance method of [ListView](#ListView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Default | Description | | --- | --- | --- | --- | | view | [View](#View) | |

the tracked view

| | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, registers view as a shared view. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed. If false, registers view as a child view which are disposed when the parent is disposed.

| ### listView.unregisterTrackedView(view) ⇒ [View](#View)

Unbinds the tracked view - no recursive calls will be made to this shared view

**Kind**: instance method of [ListView](#ListView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Description | | --- | --- | --- | | view | [View](#View) |

the shared view

| ### listView.unregisterTrackedViews([options]) ⇒ [View](#View)

Unbinds all tracked view - no recursive calls will be made to this shared view
You can limit the types of views that will be unregistered by using the options parameter.

**Kind**: instance method of [ListView](#ListView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, unregister only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, unregister only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### listView.transitionOut(done, options)

Override to provide your own transition out logic. Default logic is to just detach from the page.
The method is passed a callback that should be invoked when the transition out has fully completed.

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | done | function |

callback that MUST be invoked when the transition is complete.

| | options | |

optionals options object

| | options.currentView | [View](#View) |

the view that is being transitioned in.

| | options.previousView | [View](#View) |

the view that is being transitioned out. Typically this view.

| | options.parentView | [View](#View) |

the view that is invoking the transition.

| ### listView.transitionIn(attach, done, options)

Override to provide your own transition in logic. Default logic is to just attach to the page.
The method is passed a callback that should be invoked when the transition in has fully completed.

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | attach | function |

callback to be invoked when you want this view to be attached to the dom.
If you are trying to transition in a tracked view, consider using this.transitionInView()

| | done | function |

callback that MUST be invoked when the transition is complete.

| | options | |

optionals options object

| | options.currentView | [View](#View) |

the view that is being transitioned in.

| | options.previousView | [View](#View) |

the view that is being transitioned out. Typically this view.

| | options.parentView | [View](#View) |

the view that is invoking the transition.

| ### listView.invokeFeedback(to, [evt], [indexMap])

Invokes a feedback entry's "then" method

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | to | string |

the "to" field corresponding to the feedback entry to be invoked.

| | [evt] | Event |

the event to be passed to the "then" method

| | [indexMap] | Object |

a map from index variable name to index value. Needed for "to" fields with array notation.

| ## ListView **Kind**: global class * [ListView](#ListView) * [new ListView()](#new_ListView_new) * [new constructor(args)](#new_ListView_new) * [.collection](#ListView+collection) : [Collection](#Collection) * [.itemView](#ListView+itemView) : [View](#View) \| function * [.template](#ListView+template) : [Handlebars-Template](#external_Handlebars-Template) * [.emptyTemplate](#ListView+emptyTemplate) : [Handlebars-Template](#external_Handlebars-Template) * [.itemContainer](#ListView+itemContainer) : String * [.viewState](#View+viewState) : [ViewStateCell](#ViewStateCell) * [.setCollection(collection, preventUpdate)](#ListView+setCollection) * [.updateDOM()](#ListView+updateDOM) * [.renderChildViews()](#ListView+renderChildViews) * [.reorder()](#ListView+reorder) * [.prepareEmpty()](#ListView+prepareEmpty) ⇒ * [.modelsToRender()](#ListView+modelsToRender) * [.update()](#ListView+update) * [.getItemViewFromModel(model)](#ListView+getItemViewFromModel) ⇒ * [.hasItemViews()](#ListView+hasItemViews) ⇒ boolean * [.getItemViews()](#ListView+getItemViews) ⇒ [Array.<View>](#View) * [.get()](#View+get) * [.set()](#View+set) * [.has()](#View+has) * [.unset()](#View+unset) * [.toJSON()](#View+toJSON) * [.getBehavior(alias)](#View+getBehavior) ⇒ Torso.Behavior * [.prepare()](#View+prepare) ⇒ Object * [._prepare(context)](#View+_prepare) ⇒ Object * [.render()](#View+render) ⇒ Promise * [.prerender()](#View+prerender) ⇒ Promise \| Array.<Promise> * [.updateClassName(newClassName)](#View+updateClassName) * [.postrender()](#View+postrender) ⇒ Promise \| Array.<Promise> * [.templateRender()](#View+templateRender) * [.delegateEvents()](#View+delegateEvents) * [.undelegateEvents()](#View+undelegateEvents) * [.attachTo([$el], [options])](#View+attachTo) ⇒ Promise * [.attachView($el, view, [options])](#View+attachView) ⇒ Promise * [.attachTrackedViews()](#View+attachTrackedViews) ⇒ Promise \| Array.<Promise> * [._attached()](#View+_attached) * [.isAttachedToParent()](#View+isAttachedToParent) ⇒ boolean * [.isAttached()](#View+isAttached) ⇒ boolean * [.detach()](#View+detach) * [.detachTrackedViews([options])](#View+detachTrackedViews) * [._detached()](#View+_detached) * [.activate()](#View+activate) * [._activate()](#View+_activate) * [.isActive()](#View+isActive) ⇒ boolean * [.deactivate()](#View+deactivate) * [._deactivate()](#View+_deactivate) * [.dispose()](#View+dispose) * [._dispose()](#View+_dispose) * [.isDisposed()](#View+isDisposed) ⇒ boolean * [.hasTrackedViews([options])](#View+hasTrackedViews) ⇒ boolean * [.getTrackedViews([options])](#View+getTrackedViews) ⇒ [List.<View>](#View) * [.getTrackedView(viewCID)](#View+getTrackedView) ⇒ * [.registerTrackedView(view, [options])](#View+registerTrackedView) ⇒ [View](#View) * [.unregisterTrackedView(view)](#View+unregisterTrackedView) ⇒ [View](#View) * [.unregisterTrackedViews([options])](#View+unregisterTrackedViews) ⇒ [View](#View) * [.transitionOut(done, options)](#View+transitionOut) * [.transitionIn(attach, done, options)](#View+transitionIn) * [.invokeFeedback(to, [evt], [indexMap])](#View+invokeFeedback) ### new ListView()

A view that is backed by a collection that managers views per model in the collection.

### new constructor(args)

Constructor for the list view object.

| Param | Type | Default | Description | | --- | --- | --- | --- | | args | Object | |

options argument

| | args.itemView | [Backbone-View](#external_Backbone-View) \| function | |

the class definition of the item view. This view will be instantiated for every model returned by modelsToRender(). If a function is passed in, then for each model, this function will be invoked to find the appropriate view class. It takes the model as the only parameter.

| | args.collection | [Backbone-Collection](#external_Backbone-Collection) | |

The collection that will back this list view. A subclass of list view might provide a default collection. Can be private or public collection

| | [args.itemContext] | Object \| function | |

object or function that's passed to the item view's during initialization under the name "context". Can be used by the item view during their prepare method.

| | [args.template] | [Handlebars-Template](#external_Handlebars-Template) | |

allows a list view to hold it's own HTML like filter buttons, etc.

| | [args.itemContainer] | string | |

(Required if 'template' is provided, ignored otherwise) name of injection site for list of item views

| | [args.emptyTemplate] | [Handlebars-Template](#external_Handlebars-Template) | |

if provided, this template will be shown if the modelsToRender() method returns an empty list. If a itemContainer is provided, the empty template will be rendered there.

| | [args.modelsToRender] | function | |

If provided, this function will override the modelsToRender() method with custom functionality.

| | [args.renderWait] | number | 0 |

If provided, will collect any internally invoked renders (typically through collection events like reset) for a duration specified by renderWait in milliseconds and then calls a single render instead. Helps to remove unnecessary render calls when modifying the collection often.

| | [args.modelId] | string | "'cid'" |

one of ('cid' or 'id'): model property used as identifier for a given model. This property is saved and used to find the corresponding view.

| | [args.modelName] | string | "'model'" |

name of the model argument passed to the item view during initialization

| ### listView.collection : [Collection](#Collection)

The collection that holds the models that this list view will track

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | collection | ### listView.itemView : [View](#View) \| function

The item view class definition that will be instantiated for each model in the list.
itemView can also be a function that takes a model and returns a view class. This allows
for different view classes depending on the model.

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | itemView | ### listView.template : [Handlebars-Template](#external_Handlebars-Template)

The template that allows a list view to hold it's own HTML like filter buttons, etc.

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | template | ### listView.emptyTemplate : [Handlebars-Template](#external_Handlebars-Template)

If provided, this template that will be shown if the modelsToRender() method returns
an empty list. If an itemContainer is provided, the empty template will be rendered there.

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | emptyTemplate | ### listView.itemContainer : String

(Required if 'template' is provided, ignored otherwise) name of injection site for list of item views

**Kind**: instance property of [ListView](#ListView) **Properties** | Name | | --- | | itemContainer | ### listView.viewState : [ViewStateCell](#ViewStateCell)

Cell that can be used to save state for rendering the view.

**Kind**: instance property of [ListView](#ListView) ### listView.setCollection(collection, preventUpdate)

Sets the collection from which this view generates item views.
This method will attach all necessary event listeners to the new collection to auto-generate item views
and has the option of removing listeners on a previous collection. It will immediately update child
views and re-render if it is necessary - this behavior can be prevented with preventUpdate argument

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | collection | [Backbone-Collection](#external_Backbone-Collection) |

the new collection that this list view should use.

| | preventUpdate | boolean |

if true, the list view will not update the child views nor rerender.

| ### listView.updateDOM()

Builds a single DOM fragment from the item views and attaches it at once.

**Kind**: instance method of [ListView](#ListView) **Overrides**: [updateDOM](#View+updateDOM) ### listView.renderChildViews()

Loops through children views and renders them

**Kind**: instance method of [ListView](#ListView) ### listView.reorder()

Takes existing item views and moves them into correct order defined by
this.modelsToRender(). NOTE: As this method doesn't generate or remove views,
this method takes advantage of jquery's ability to move elements already attached to the DOM.

**Kind**: instance method of [ListView](#ListView) ### listView.prepareEmpty() ⇒

Override if you want a different context for your empty template. Defaults to this.prepare()

**Kind**: instance method of [ListView](#ListView) **Returns**:

a context that can be used by the empty list template

### listView.modelsToRender()

Returns an array of which models should be rendered.
By default, all models in the input collection will be
shown. Extensions of this class may override this
method to apply collection filters.

**Kind**: instance method of [ListView](#ListView) ### listView.update()

Builds any new views, removes stale ones, and re-renders

**Kind**: instance method of [ListView](#ListView) ### listView.getItemViewFromModel(model) ⇒

Returns the view that corresponds to the model if one exists

**Kind**: instance method of [ListView](#ListView) **Returns**:

the item view corresponding to the model

| Param | Type | Description | | --- | --- | --- | | model | [Model](#Model) |

the model

| ### listView.hasItemViews() ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

returns true if there exists any generated item views

### listView.getItemViews() ⇒ [Array.<View>](#View) **Kind**: instance method of [ListView](#ListView) **Returns**: [Array.<View>](#View) -

Returns unordered list of views generated by this list view

### listView.get()

Alias to this.viewState.get()

**Kind**: instance method of [ListView](#ListView) ### listView.set()

Alias to this.viewState.set()

**Kind**: instance method of [ListView](#ListView) ### listView.has()

Alias to this.viewState.has()

**Kind**: instance method of [ListView](#ListView) ### listView.unset()

Alias to this.viewState.unset()

**Kind**: instance method of [ListView](#ListView) ### listView.toJSON()

Alias to this.viewState.toJSON()

**Kind**: instance method of [ListView](#ListView) ### listView.getBehavior(alias) ⇒ Torso.Behavior **Kind**: instance method of [ListView](#ListView) **Returns**: Torso.Behavior -

the behavior instance if one exists with that alias

| Param | Type | Description | | --- | --- | --- | | alias | string |

the name/alias of the behavior

| ### listView.prepare() ⇒ Object

prepareFields can be used to augment the default render method contents.
See __getPrepareFieldsContext() for more details on how to configure them.

**Kind**: instance method of [ListView](#ListView) **Returns**: Object -

context for a render method. Defaults to:
{view: this.viewState.toJSON(), model: this.model.toJSON()}

### listView.\_prepare(context) ⇒ Object

Extension point to augment the template context with custom content.

**Kind**: instance method of [ListView](#ListView) **Returns**: Object -

[Optional] If you return an object, it will be merged with the context

| Param | Description | | --- | --- | | context |

the context you can modify

| ### listView.render() ⇒ Promise

Rebuilds the html for this view's element. Should be able to be called at any time.
Defaults to using this.templateRender. Assumes that this.template is a javascript
function that accepted a single JSON context.
The render method returns a promise that resolves when rendering is complete. Typically render
is synchronous and the rendering is complete upon completion of the method. However, when utilizing
transitions/animations, the render process can be asynchronous and the promise is useful to know when it has finished.

**Kind**: instance method of [ListView](#ListView) **Returns**: Promise -

a promise that when resolved signifies that the rendering process is complete.

### listView.prerender() ⇒ Promise \| Array.<Promise>

Hook during render that is invoked before any DOM rendering is performed.
This method can be overwritten as usual OR extended using .prototype.prerender.apply(this, arguments);
NOTE: if you require the view to be detached from the DOM, consider using _detach callback</p> **Kind**: instance method of [ListView](#ListView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, prerender is finished. Note: render logic will not wait until promises are resolved.

### listView.updateClassName(newClassName)

Updates this view element's class attribute with the value provided.
If no value provided, removes the class attribute of this view element.

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | newClassName | string |

the new value of the class attribute

| ### listView.postrender() ⇒ Promise \| Array.<Promise>

Hook during render that is invoked after all DOM rendering is done and tracked views attached.
This method can be overwritten as usual OR extended using .prototype.postrender.apply(this, arguments);
NOTE: if you require the view to be attached to the DOM, consider using _attach callback</p> **Kind**: instance method of [ListView](#ListView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, postrender is finished. Note: render logic will not wait until promises are resolved.

### listView.templateRender()

Hotswap rendering system reroute method.
See Torso.templateRenderer#render for params

**Kind**: instance method of [ListView](#ListView) ### listView.delegateEvents()

Overrides the base delegateEvents
Binds DOM events with the view using events hash while also adding feedback event bindings

**Kind**: instance method of [ListView](#ListView) ### listView.undelegateEvents()

Overrides undelegateEvents
Unbinds DOM events from the view.

**Kind**: instance method of [ListView](#ListView) ### listView.attachTo([$el], [options]) ⇒ Promise

If detached, will replace the element passed in with this view's element and activate the view.

**Kind**: instance method of [ListView](#ListView) **Returns**: Promise -

promise that when resolved, the attach process is complete. Normally this method is synchronous. Transition effects can
make it asynchronous.

| Param | Type | Default | Description | | --- | --- | --- | --- | | [$el] | [jQuery](#external_jQuery) | |

the element to attach to. This element will be replaced with this view.
If options.replaceMethod is provided, then this parameter is ignored.

| | [options] | Object | |

optional options

| | [options.replaceMethod] | Fucntion | |

if given, this view will invoke replaceMethod function
in order to attach the view's DOM to the parent instead of calling $el.replaceWith

| | [options.discardInjectionSite] | Booleon | false |

if set to true, the injection site is not saved.

| ### listView.attachView($el, view, [options]) ⇒ Promise

Registers the view as a tracked view (defaulting as a child view), then calls view.attachTo with the element argument
The element argument can be a String that references an element with the corresponding "inject" attribute.
When using attachView with options.useTransition:
Will inject a new view into an injection site by using the new view's transitionIn method. If the parent view
previously had another view at this injections site, this previous view will be removed with that view's transitionOut.
If this method is used within a render, the current views' injection sites will be cached so they can be transitioned out even
though they are detached in the process of re-rendering. If no previous view is given and none can be found, the new view is transitioned in regardless.
If the previous view is the same as the new view, it is injected normally without transitioning in.
The previous view must has used an injection site with the standard "inject=" attribute to be found.
When the transitionIn and transitionOut methods are invoked on the new and previous views, the options parameter will be passed on to them. Other fields
will be added to the options parameter to allow better handling of the transitions. These include:
{
newView: the new view
previousView: the previous view (can be undefined)
parentView: the parent view transitioning in or out the tracked view
}</p> **Kind**: instance method of [ListView](#ListView) **Returns**: Promise -

resolved when all transitions are complete. No payload is provided upon resolution. If no transitions, then returns a resolved promise.

| Param | Type | Default | Description | | --- | --- | --- | --- | | $el | [jQuery](#external_jQuery) \| string | |

the element to attach to OR the name of the injection site. The element with the attribute "inject=" will be used.</p> | | view | [View](#View) | |

The instantiated view object to be attached

| | [options] | Object | |

optionals options object. If using transitions, this options object will be passed on to the transitionIn and transitionOut methods as well.

| | [options.noActivate] | boolean | false |

if set to true, the view will not be activated upon attaching.

| | [options.shared] | boolean | false |

if set to true, the view will be treated as a shared view and not disposed during parent view disposing.

| | [options.useTransition] | boolean | false |

if set to true, this method will delegate attach logic to this.__transitionNewViewIntoSite

| | [options.addBefore] | boolean | false |

if true, and options.useTransition is true, the new view's element will be added before the previous view's element. Defaults to after.

| | [options.previousView] | [View](#View) | |

if using options.useTransition, then you can explicitly define the view that should be transitioned out.
If using transitions and no previousView is provided, it will look to see if a view already is at this injection site and uses that by default.

| ### listView.attachTrackedViews() ⇒ Promise \| Array.<Promise>

Hook to attach all your tracked views. This hook will be called after all DOM rendering is done so injection sites should be available.
This method can be overwritten as usual OR extended using .prototype.attachTrackedViews.apply(this, arguments);</p> **Kind**: instance method of [ListView](#ListView) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, all tracked views are attached. Useful when using this.attachView with useTransition=true.

### listView.\_attached()

Method to be invoked when the view is fully attached to the DOM (NOT just the parent). Use this method to manipulate the view
after the DOM has been attached to the document. The default implementation is a no-op.

**Kind**: instance method of [ListView](#ListView) ### listView.isAttachedToParent() ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if the view is attached to a parent

### listView.isAttached() ⇒ boolean

NOTE: depends on a global variable "document"

**Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if the view is attached to the DOM

### listView.detach()

If attached, will detach the view from the DOM.
This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach
callback on each tracked view recursively.

**Kind**: instance method of [ListView](#ListView) ### listView.detachTrackedViews([options])

Detach all tracked views or a subset of them based on the options parameter.
NOTE: this is not recursive - it will not separate the entire view tree.

**Kind**: instance method of [ListView](#ListView) | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, detach only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, detach only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### listView.\_detached()

Method to be invoked when the view is detached from the DOM (NOT just the parent). Use this method to clean up state
after the view has been removed from the document. The default implementation is a no-op.

**Kind**: instance method of [ListView](#ListView) ### listView.activate()

Resets listeners and events in order for the view to be reattached to the visible DOM

**Kind**: instance method of [ListView](#ListView) ### listView.\_activate()

Method to be invoked when activate is called. Use this method to turn on any
custom timers, listenTo's or on's that should be activatable. The default implementation is a no-op.

**Kind**: instance method of [ListView](#ListView) ### listView.isActive() ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if the view is active

### listView.deactivate()

Maintains view state and DOM but prevents view from becoming a zombie by removing listeners
and events that may affect user experience. Recursively invokes deactivate on child views

**Kind**: instance method of [ListView](#ListView) ### listView.\_deactivate()

Method to be invoked when deactivate is called. Use this method to turn off any
custom timers, listenTo's or on's that should be deactivatable. The default implementation is a no-op.

**Kind**: instance method of [ListView](#ListView) ### listView.dispose()

Removes all listeners, disposes children views, stops listening to events, removes DOM.
After dispose is called, the view can be safely garbage collected. Called while
recursively removing views from the hierarchy.

**Kind**: instance method of [ListView](#ListView) ### listView.\_dispose()

Method to be invoked when dispose is called. By default calling dispose will remove the
view's element, its on's, listenTo's, and any registered children.
Override this method to destruct any extra

**Kind**: instance method of [ListView](#ListView) ### listView.isDisposed() ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if the view was disposed

### listView.hasTrackedViews([options]) ⇒ boolean **Kind**: instance method of [ListView](#ListView) **Returns**: boolean -

true if this view has tracked views (limited by the options parameter)

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, only check the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, only check the child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### listView.getTrackedViews([options]) ⇒ [List.<View>](#View)

Returns all tracked views, both child views and shared views.

**Kind**: instance method of [ListView](#ListView) **Returns**: [List.<View>](#View) -

all tracked views (filtered by options parameter)

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, get only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, get only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### listView.getTrackedView(viewCID) ⇒ **Kind**: instance method of [ListView](#ListView) **Returns**:

the view with the given cid. Will look in both shared and child views.

| Param | Type | Description | | --- | --- | --- | | viewCID | string |

the cid of the view

| ### listView.registerTrackedView(view, [options]) ⇒ [View](#View)

Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will
be done to the tracked view as well. Except dispose for shared views. This method defaults to register the
view as a child view unless specified by options.shared.

**Kind**: instance method of [ListView](#ListView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Default | Description | | --- | --- | --- | --- | | view | [View](#View) | |

the tracked view

| | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, registers view as a shared view. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed. If false, registers view as a child view which are disposed when the parent is disposed.

| ### listView.unregisterTrackedView(view) ⇒ [View](#View)

Unbinds the tracked view - no recursive calls will be made to this shared view

**Kind**: instance method of [ListView](#ListView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Description | | --- | --- | --- | | view | [View](#View) |

the shared view

| ### listView.unregisterTrackedViews([options]) ⇒ [View](#View)

Unbinds all tracked view - no recursive calls will be made to this shared view
You can limit the types of views that will be unregistered by using the options parameter.

**Kind**: instance method of [ListView](#ListView) **Returns**: [View](#View) -

the tracked view

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, unregister only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, unregister only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### listView.transitionOut(done, options)

Override to provide your own transition out logic. Default logic is to just detach from the page.
The method is passed a callback that should be invoked when the transition out has fully completed.

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | done | function |

callback that MUST be invoked when the transition is complete.

| | options | |

optionals options object

| | options.currentView | [View](#View) |

the view that is being transitioned in.

| | options.previousView | [View](#View) |

the view that is being transitioned out. Typically this view.

| | options.parentView | [View](#View) |

the view that is invoking the transition.

| ### listView.transitionIn(attach, done, options)

Override to provide your own transition in logic. Default logic is to just attach to the page.
The method is passed a callback that should be invoked when the transition in has fully completed.

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | attach | function |

callback to be invoked when you want this view to be attached to the dom.
If you are trying to transition in a tracked view, consider using this.transitionInView()

| | done | function |

callback that MUST be invoked when the transition is complete.

| | options | |

optionals options object

| | options.currentView | [View](#View) |

the view that is being transitioned in.

| | options.previousView | [View](#View) |

the view that is being transitioned out. Typically this view.

| | options.parentView | [View](#View) |

the view that is invoking the transition.

| ### listView.invokeFeedback(to, [evt], [indexMap])

Invokes a feedback entry's "then" method

**Kind**: instance method of [ListView](#ListView) | Param | Type | Description | | --- | --- | --- | | to | string |

the "to" field corresponding to the feedback entry to be invoked.

| | [evt] | Event |

the event to be passed to the "then" method

| | [indexMap] | Object |

a map from index variable name to index value. Needed for "to" fields with array notation.

| ## Model ⇐ [Backbone-Model](#external_Backbone-Model) **Kind**: global class **Extends**: [Backbone-Model](#external_Backbone-Model) **Mixes**: [pollingMixin](#pollingMixin), [modelMixin](#modelMixin) **See**: Model Annotated Source **Author**: kent.willis@vecna.com * [Model](#Model) ⇐ [Backbone-Model](#external_Backbone-Model) * [new Model(attributes, [options])](#new_Model_new) * [.pollTimeoutId](#Model+pollTimeoutId) * [.isPolling()](#Model+isPolling) * [.startPolling(pollInterval)](#Model+startPolling) * [.stopPolling()](#Model+stopPolling) * [.polledFetch()](#Model+polledFetch) * [.dispose()](#Model+dispose) * [._dispose()](#Model+_dispose) ### new Model(attributes, [options])

Generic Model

| Param | Type | Default | Description | | --- | --- | --- | --- | | attributes | Object | |

the initial attributes to use for this model.

| | [options] | Object | {} |

the options for setting up this model.

| | [options.register] | boolean | 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.

| ### model.pollTimeoutId **Kind**: instance property of [Model](#Model) **Mixes**: [pollTimeoutId](#pollingMixin.pollTimeoutId) **Properties** | Name | Type | Description | | --- | --- | --- | | pollTimeoutId | number |

The id from when setTimeout was called to start polling.

| ### model.isPolling()

Returns true if the poll is active

**Kind**: instance method of [Model](#Model) **Mixes**: [isPolling](#pollingMixin.isPolling) ### model.startPolling(pollInterval)

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.

**Kind**: instance method of [Model](#Model) **Mixes**: [startPolling](#pollingMixin.startPolling) | Param | Type | Description | | --- | --- | --- | | pollInterval | Integer |

interval between each poll in ms.

| ### model.stopPolling()

Stops polling Model and clears all Timeouts.

**Kind**: instance method of [Model](#Model) **Mixes**: [stopPolling](#pollingMixin.stopPolling) ### model.polledFetch()

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

**Kind**: instance method of [Model](#Model) **Mixes**: [polledFetch](#pollingMixin.polledFetch) ### model.dispose()

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".

**Kind**: instance method of [Model](#Model) **Mixes**: [dispose](#modelMixin.dispose) ### model.\_dispose()

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

**Kind**: instance method of [Model](#Model) **Mixes**: [\_dispose](#modelMixin._dispose) ## NestedCell ⇐ [NestedModel](#NestedModel) **Kind**: global class **Extends**: [NestedModel](#NestedModel) **Mixes**: [cellMixin](#cellMixin) **See**: NestedCell Annotated Source **Author**: kent.willis@vecna.com * [NestedCell](#NestedCell) ⇐ [NestedModel](#NestedModel) * [new NestedCell(attributes, [options])](#new_NestedCell_new) * [.isModelCompatible](#NestedCell+isModelCompatible) * [.pollTimeoutId](#NestedModel+pollTimeoutId) * [.save()](#NestedCell+save) * [.fetch()](#NestedCell+fetch) * [.sync()](#NestedCell+sync) * [.url()](#NestedCell+url) * [.isPolling()](#NestedModel+isPolling) * [.startPolling(pollInterval)](#NestedModel+startPolling) * [.stopPolling()](#NestedModel+stopPolling) * [.polledFetch()](#NestedModel+polledFetch) * [.dispose()](#NestedModel+dispose) * [._dispose()](#NestedModel+_dispose) ### new NestedCell(attributes, [options])

Generic Nested Cell

| Param | Type | Default | Description | | --- | --- | --- | --- | | attributes | Object | |

the initial attributes to use for this cell.

| | [options] | Object | {} |

the options for setting up this cell.

| | [options.register] | boolean | false |

whether to register this cell 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.

| ### nestedCell.isModelCompatible

Whether a cell can pass as a model or not.
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invoked

**Kind**: instance property of [NestedCell](#NestedCell) **Mixes**: [isModelCompatible](#cellMixin.isModelCompatible) **Default**: false **Properties** | Name | Type | | --- | --- | | isModelCompatible | boolean | ### nestedCell.pollTimeoutId **Kind**: instance property of [NestedCell](#NestedCell) **Mixes**: [pollTimeoutId](#pollingMixin.pollTimeoutId) **Properties** | Name | Type | Description | | --- | --- | --- | | pollTimeoutId | number |

The id from when setTimeout was called to start polling.

| ### nestedCell.save()

Override and disable the save function

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [save](#cellMixin.save) ### nestedCell.fetch()

Override and disable the fetch function

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [fetch](#cellMixin.fetch) ### nestedCell.sync()

Override and disable the sync function

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [sync](#cellMixin.sync) ### nestedCell.url()

Override and disable the url

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [url](#cellMixin.url) ### nestedCell.isPolling()

Returns true if the poll is active

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [isPolling](#pollingMixin.isPolling) ### nestedCell.startPolling(pollInterval)

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.

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [startPolling](#pollingMixin.startPolling) | Param | Type | Description | | --- | --- | --- | | pollInterval | Integer |

interval between each poll in ms.

| ### nestedCell.stopPolling()

Stops polling Model and clears all Timeouts.

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [stopPolling](#pollingMixin.stopPolling) ### nestedCell.polledFetch()

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

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [polledFetch](#pollingMixin.polledFetch) ### nestedCell.dispose()

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".

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [dispose](#modelMixin.dispose) ### nestedCell.\_dispose()

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

**Kind**: instance method of [NestedCell](#NestedCell) **Mixes**: [\_dispose](#modelMixin._dispose) ## NestedModel ⇐ [Backbone-NestedModel](#external_Backbone-NestedModel) **Kind**: global class **Extends**: [Backbone-NestedModel](#external_Backbone-NestedModel) **Mixes**: [pollingMixin](#pollingMixin), [modelMixin](#modelMixin) **See**: NestedModel Annotated Source **Author**: kent.willis@vecna.com * [NestedModel](#NestedModel) ⇐ [Backbone-NestedModel](#external_Backbone-NestedModel) * [new NestedModel(attributes, [options])](#new_NestedModel_new) * [.pollTimeoutId](#NestedModel+pollTimeoutId) * [.isPolling()](#NestedModel+isPolling) * [.startPolling(pollInterval)](#NestedModel+startPolling) * [.stopPolling()](#NestedModel+stopPolling) * [.polledFetch()](#NestedModel+polledFetch) * [.dispose()](#NestedModel+dispose) * [._dispose()](#NestedModel+_dispose) ### new NestedModel(attributes, [options])

Generic Nested Model

| Param | Type | Default | Description | | --- | --- | --- | --- | | attributes | Object | |

the initial attributes to use for this model.

| | [options] | Object | {} |

the options for setting up this model.

| | [options.register] | boolean | 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.

| ### nestedModel.pollTimeoutId **Kind**: instance property of [NestedModel](#NestedModel) **Mixes**: [pollTimeoutId](#pollingMixin.pollTimeoutId) **Properties** | Name | Type | Description | | --- | --- | --- | | pollTimeoutId | number |

The id from when setTimeout was called to start polling.

| ### nestedModel.isPolling()

Returns true if the poll is active

**Kind**: instance method of [NestedModel](#NestedModel) **Mixes**: [isPolling](#pollingMixin.isPolling) ### nestedModel.startPolling(pollInterval)

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.

**Kind**: instance method of [NestedModel](#NestedModel) **Mixes**: [startPolling](#pollingMixin.startPolling) | Param | Type | Description | | --- | --- | --- | | pollInterval | Integer |

interval between each poll in ms.

| ### nestedModel.stopPolling()

Stops polling Model and clears all Timeouts.

**Kind**: instance method of [NestedModel](#NestedModel) **Mixes**: [stopPolling](#pollingMixin.stopPolling) ### nestedModel.polledFetch()

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

**Kind**: instance method of [NestedModel](#NestedModel) **Mixes**: [polledFetch](#pollingMixin.polledFetch) ### nestedModel.dispose()

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".

**Kind**: instance method of [NestedModel](#NestedModel) **Mixes**: [dispose](#modelMixin.dispose) ### nestedModel.\_dispose()

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

**Kind**: instance method of [NestedModel](#NestedModel) **Mixes**: [\_dispose](#modelMixin._dispose) ## Router ⇐ [Backbone-Router](#external_Backbone-Router) **Kind**: global class **Extends**: [Backbone-Router](#external_Backbone-Router) **See**: Router Annotated Source **Author**: kent.willis@vecna.com ### new Router()

Backbone's router.

## ServiceCell ⇐ [Cell](#Cell) **Kind**: global class **Extends**: [Cell](#Cell) **See**: ServiceCell Annotated Source **Author**: kent.willis@vecna.com * [ServiceCell](#ServiceCell) ⇐ [Cell](#Cell) * [new ServiceCell(attributes, [options])](#new_ServiceCell_new) * [.isModelCompatible](#Cell+isModelCompatible) * [.save()](#Cell+save) * [.fetch()](#Cell+fetch) * [.sync()](#Cell+sync) * [.url()](#Cell+url) ### new ServiceCell(attributes, [options])

A service cell is a event listening and event emitting object that is independent of any model or view.

| Param | Type | Default | Description | | --- | --- | --- | --- | | attributes | Object | |

the initial attributes to use for this service.

| | [options] | Object | {} |

the options for setting up this service.

| | [options.register] | boolean | true |

whether to register this service in the app-level registry.
By default this WILL add it to the registry unless set to false because
most services are global so holding on to them beyond

| ### serviceCell.isModelCompatible

Whether a cell can pass as a model or not.
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invoked

**Kind**: instance property of [ServiceCell](#ServiceCell) **Mixes**: [isModelCompatible](#cellMixin.isModelCompatible) **Default**: false **Properties** | Name | Type | | --- | --- | | isModelCompatible | boolean | ### serviceCell.save()

Override and disable the save function

**Kind**: instance method of [ServiceCell](#ServiceCell) **Mixes**: [save](#cellMixin.save) ### serviceCell.fetch()

Override and disable the fetch function

**Kind**: instance method of [ServiceCell](#ServiceCell) **Mixes**: [fetch](#cellMixin.fetch) ### serviceCell.sync()

Override and disable the sync function

**Kind**: instance method of [ServiceCell](#ServiceCell) **Mixes**: [sync](#cellMixin.sync) ### serviceCell.url()

Override and disable the url

**Kind**: instance method of [ServiceCell](#ServiceCell) **Mixes**: [url](#cellMixin.url) ## ViewStateCell ⇐ [NestedCell](#NestedCell) **Kind**: global class **Extends**: [NestedCell](#NestedCell) **See**: View Annotated Source * [ViewStateCell](#ViewStateCell) ⇐ [NestedCell](#NestedCell) * [new ViewStateCell(attrs, opts)](#new_ViewStateCell_new) * [new initialize(attrs, opts)](#new_ViewStateCell_new) * [.isModelCompatible](#NestedCell+isModelCompatible) * [.pollTimeoutId](#NestedModel+pollTimeoutId) * [.trigger()](#ViewStateCell+trigger) * [.save()](#NestedCell+save) * [.fetch()](#NestedCell+fetch) * [.sync()](#NestedCell+sync) * [.url()](#NestedCell+url) * [.isPolling()](#NestedModel+isPolling) * [.startPolling(pollInterval)](#NestedModel+startPolling) * [.stopPolling()](#NestedModel+stopPolling) * [.polledFetch()](#NestedModel+polledFetch) * [.dispose()](#NestedModel+dispose) * [._dispose()](#NestedModel+_dispose) ### new ViewStateCell(attrs, opts)

ViewStateCell is a NestedCell that holds view state data and can trigger
change events. These change events will propagate up and trigger on the view
as well.

| Param | Type | Description | | --- | --- | --- | | attrs | Object |

the initial values to set on the cell - inherited from [NestedCell](#NestedCell).

| | opts | Object |

options for the cell.

| | opts.view | [Backbone-View](#external_Backbone-View) |

the view that these options are tied to.

| ### new initialize(attrs, opts) | Param | Type | Description | | --- | --- | --- | | attrs | Object |

the initial values to set on the cell - inherited from [NestedCell](#NestedCell).

| | opts | Object |

options for the cell.

| | opts.view | [Backbone-View](#external_Backbone-View) |

the view that these options are tied to.

| ### viewStateCell.isModelCompatible

Whether a cell can pass as a model or not.
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invoked

**Kind**: instance property of [ViewStateCell](#ViewStateCell) **Mixes**: [isModelCompatible](#cellMixin.isModelCompatible) **Default**: false **Properties** | Name | Type | | --- | --- | | isModelCompatible | boolean | ### viewStateCell.pollTimeoutId **Kind**: instance property of [ViewStateCell](#ViewStateCell) **Mixes**: [pollTimeoutId](#pollingMixin.pollTimeoutId) **Properties** | Name | Type | Description | | --- | --- | --- | | pollTimeoutId | number |

The id from when setTimeout was called to start polling.

| ### viewStateCell.trigger()

Retrigger view state change events on the view as well.

**Kind**: instance method of [ViewStateCell](#ViewStateCell) ### viewStateCell.save()

Override and disable the save function

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [save](#cellMixin.save) ### viewStateCell.fetch()

Override and disable the fetch function

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [fetch](#cellMixin.fetch) ### viewStateCell.sync()

Override and disable the sync function

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [sync](#cellMixin.sync) ### viewStateCell.url()

Override and disable the url

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [url](#cellMixin.url) ### viewStateCell.isPolling()

Returns true if the poll is active

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [isPolling](#pollingMixin.isPolling) ### viewStateCell.startPolling(pollInterval)

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.

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [startPolling](#pollingMixin.startPolling) | Param | Type | Description | | --- | --- | --- | | pollInterval | Integer |

interval between each poll in ms.

| ### viewStateCell.stopPolling()

Stops polling Model and clears all Timeouts.

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [stopPolling](#pollingMixin.stopPolling) ### viewStateCell.polledFetch()

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

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [polledFetch](#pollingMixin.polledFetch) ### viewStateCell.dispose()

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".

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [dispose](#modelMixin.dispose) ### viewStateCell.\_dispose()

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

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [\_dispose](#modelMixin._dispose) ## ViewStateCell **Kind**: global class * [ViewStateCell](#ViewStateCell) * [new ViewStateCell(attrs, opts)](#new_ViewStateCell_new) * [new initialize(attrs, opts)](#new_ViewStateCell_new) * [.isModelCompatible](#NestedCell+isModelCompatible) * [.pollTimeoutId](#NestedModel+pollTimeoutId) * [.trigger()](#ViewStateCell+trigger) * [.save()](#NestedCell+save) * [.fetch()](#NestedCell+fetch) * [.sync()](#NestedCell+sync) * [.url()](#NestedCell+url) * [.isPolling()](#NestedModel+isPolling) * [.startPolling(pollInterval)](#NestedModel+startPolling) * [.stopPolling()](#NestedModel+stopPolling) * [.polledFetch()](#NestedModel+polledFetch) * [.dispose()](#NestedModel+dispose) * [._dispose()](#NestedModel+_dispose) ### new ViewStateCell(attrs, opts)

ViewStateCell is a NestedCell that holds view state data and can trigger
change events. These change events will propagate up and trigger on the view
as well.

| Param | Type | Description | | --- | --- | --- | | attrs | Object |

the initial values to set on the cell - inherited from [NestedCell](#NestedCell).

| | opts | Object |

options for the cell.

| | opts.view | [Backbone-View](#external_Backbone-View) |

the view that these options are tied to.

| ### new initialize(attrs, opts) | Param | Type | Description | | --- | --- | --- | | attrs | Object |

the initial values to set on the cell - inherited from [NestedCell](#NestedCell).

| | opts | Object |

options for the cell.

| | opts.view | [Backbone-View](#external_Backbone-View) |

the view that these options are tied to.

| ### viewStateCell.isModelCompatible

Whether a cell can pass as a model or not.
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invoked

**Kind**: instance property of [ViewStateCell](#ViewStateCell) **Mixes**: [isModelCompatible](#cellMixin.isModelCompatible) **Default**: false **Properties** | Name | Type | | --- | --- | | isModelCompatible | boolean | ### viewStateCell.pollTimeoutId **Kind**: instance property of [ViewStateCell](#ViewStateCell) **Mixes**: [pollTimeoutId](#pollingMixin.pollTimeoutId) **Properties** | Name | Type | Description | | --- | --- | --- | | pollTimeoutId | number |

The id from when setTimeout was called to start polling.

| ### viewStateCell.trigger()

Retrigger view state change events on the view as well.

**Kind**: instance method of [ViewStateCell](#ViewStateCell) ### viewStateCell.save()

Override and disable the save function

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [save](#cellMixin.save) ### viewStateCell.fetch()

Override and disable the fetch function

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [fetch](#cellMixin.fetch) ### viewStateCell.sync()

Override and disable the sync function

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [sync](#cellMixin.sync) ### viewStateCell.url()

Override and disable the url

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [url](#cellMixin.url) ### viewStateCell.isPolling()

Returns true if the poll is active

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [isPolling](#pollingMixin.isPolling) ### viewStateCell.startPolling(pollInterval)

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.

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [startPolling](#pollingMixin.startPolling) | Param | Type | Description | | --- | --- | --- | | pollInterval | Integer |

interval between each poll in ms.

| ### viewStateCell.stopPolling()

Stops polling Model and clears all Timeouts.

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [stopPolling](#pollingMixin.stopPolling) ### viewStateCell.polledFetch()

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

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [polledFetch](#pollingMixin.polledFetch) ### viewStateCell.dispose()

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".

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [dispose](#modelMixin.dispose) ### viewStateCell.\_dispose()

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

**Kind**: instance method of [ViewStateCell](#ViewStateCell) **Mixes**: [\_dispose](#modelMixin._dispose) ## View ⇐ [Backbone-View](#external_Backbone-View)

View

**Kind**: global class **Extends**: [Backbone-View](#external_Backbone-View) **See**: View Annotated Source **Author**: ariel.wexler@vecna.com, kent.willis@vecna.com * [View](#View) ⇐ [Backbone-View](#external_Backbone-View) * [new constructor()](#new_View_new) * [.viewState](#View+viewState) : [ViewStateCell](#ViewStateCell) * [.get()](#View+get) * [.set()](#View+set) * [.has()](#View+has) * [.unset()](#View+unset) * [.toJSON()](#View+toJSON) * [.getBehavior(alias)](#View+getBehavior) ⇒ Torso.Behavior * [.prepare()](#View+prepare) ⇒ Object * [._prepare(context)](#View+_prepare) ⇒ Object * [.render()](#View+render) ⇒ Promise * [.prerender()](#View+prerender) ⇒ Promise \| Array.<Promise> * [.updateDOM()](#View+updateDOM) * [.updateClassName(newClassName)](#View+updateClassName) * [.postrender()](#View+postrender) ⇒ Promise \| Array.<Promise> * [.templateRender()](#View+templateRender) * [.delegateEvents()](#View+delegateEvents) * [.undelegateEvents()](#View+undelegateEvents) * [.attachTo([$el], [options])](#View+attachTo) ⇒ Promise * [.attachView($el, view, [options])](#View+attachView) ⇒ Promise * [.attachTrackedViews()](#View+attachTrackedViews) ⇒ Promise \| Array.<Promise> * [._attached()](#View+_attached) * [.isAttachedToParent()](#View+isAttachedToParent) ⇒ boolean * [.isAttached()](#View+isAttached) ⇒ boolean * [.detach()](#View+detach) * [.detachTrackedViews([options])](#View+detachTrackedViews) * [._detached()](#View+_detached) * [.activate()](#View+activate) * [._activate()](#View+_activate) * [.isActive()](#View+isActive) ⇒ boolean * [.deactivate()](#View+deactivate) * [._deactivate()](#View+_deactivate) * [.dispose()](#View+dispose) * [._dispose()](#View+_dispose) * [.isDisposed()](#View+isDisposed) ⇒ boolean * [.hasTrackedViews([options])](#View+hasTrackedViews) ⇒ boolean * [.getTrackedViews([options])](#View+getTrackedViews) ⇒ [List.<View>](#View) * [.getTrackedView(viewCID)](#View+getTrackedView) ⇒ * [.registerTrackedView(view, [options])](#View+registerTrackedView) ⇒ [View](#View) * [.unregisterTrackedView(view)](#View+unregisterTrackedView) ⇒ [View](#View) * [.unregisterTrackedViews([options])](#View+unregisterTrackedViews) ⇒ [View](#View) * [.transitionOut(done, options)](#View+transitionOut) * [.transitionIn(attach, done, options)](#View+transitionIn) * [.invokeFeedback(to, [evt], [indexMap])](#View+invokeFeedback) ### new constructor()

Overrides constructor to create needed fields and invoke activate/render after initialization

Generic View that deals with:

### view.viewState : [ViewStateCell](#ViewStateCell)

Cell that can be used to save state for rendering the view.

**Kind**: instance property of [View](#View) ### view.get()

Alias to this.viewState.get()

**Kind**: instance method of [View](#View) ### view.set()

Alias to this.viewState.set()

**Kind**: instance method of [View](#View) ### view.has()

Alias to this.viewState.has()

**Kind**: instance method of [View](#View) ### view.unset()

Alias to this.viewState.unset()

**Kind**: instance method of [View](#View) ### view.toJSON()

Alias to this.viewState.toJSON()

**Kind**: instance method of [View](#View) ### view.getBehavior(alias) ⇒ Torso.Behavior **Kind**: instance method of [View](#View) **Returns**: Torso.Behavior -

the behavior instance if one exists with that alias

| Param | Type | Description | | --- | --- | --- | | alias | string |

the name/alias of the behavior

| ### view.prepare() ⇒ Object

prepareFields can be used to augment the default render method contents.
See __getPrepareFieldsContext() for more details on how to configure them.

**Kind**: instance method of [View](#View) **Returns**: Object -

context for a render method. Defaults to:
{view: this.viewState.toJSON(), model: this.model.toJSON()}

### view.\_prepare(context) ⇒ Object

Extension point to augment the template context with custom content.

**Kind**: instance method of [View](#View) **Returns**: Object -

[Optional] If you return an object, it will be merged with the context

| Param | Description | | --- | --- | | context |

the context you can modify

| ### view.render() ⇒ Promise

Rebuilds the html for this view's element. Should be able to be called at any time.
Defaults to using this.templateRender. Assumes that this.template is a javascript
function that accepted a single JSON context.
The render method returns a promise that resolves when rendering is complete. Typically render
is synchronous and the rendering is complete upon completion of the method. However, when utilizing
transitions/animations, the render process can be asynchronous and the promise is useful to know when it has finished.

**Kind**: instance method of [View](#View) **Returns**: Promise -

a promise that when resolved signifies that the rendering process is complete.

### view.prerender() ⇒ Promise \| Array.<Promise>

Hook during render that is invoked before any DOM rendering is performed.
This method can be overwritten as usual OR extended using .prototype.prerender.apply(this, arguments);
NOTE: if you require the view to be detached from the DOM, consider using _detach callback</p> **Kind**: instance method of [View](#View) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, prerender is finished. Note: render logic will not wait until promises are resolved.

### view.updateDOM()

Produces and sets this view's elements DOM. Used during the rendering process. Override if you have custom DOM update logic.
Defaults to using the stanrdard: this.templateRender(this.$el, this.template, this.prepare(), templateRendererOptions);
this.templateRendererOptions is an object or function defined on the view that is passed into the renderer.
Examples include: views with no template or multiple templates, or if you wish to use a different rendering engine than the templateRenderer or wish to pass options to it.

**Kind**: instance method of [View](#View) ### view.updateClassName(newClassName)

Updates this view element's class attribute with the value provided.
If no value provided, removes the class attribute of this view element.

**Kind**: instance method of [View](#View) | Param | Type | Description | | --- | --- | --- | | newClassName | string |

the new value of the class attribute

| ### view.postrender() ⇒ Promise \| Array.<Promise>

Hook during render that is invoked after all DOM rendering is done and tracked views attached.
This method can be overwritten as usual OR extended using .prototype.postrender.apply(this, arguments);
NOTE: if you require the view to be attached to the DOM, consider using _attach callback</p> **Kind**: instance method of [View](#View) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, postrender is finished. Note: render logic will not wait until promises are resolved.

### view.templateRender()

Hotswap rendering system reroute method.
See Torso.templateRenderer#render for params

**Kind**: instance method of [View](#View) ### view.delegateEvents()

Overrides the base delegateEvents
Binds DOM events with the view using events hash while also adding feedback event bindings

**Kind**: instance method of [View](#View) ### view.undelegateEvents()

Overrides undelegateEvents
Unbinds DOM events from the view.

**Kind**: instance method of [View](#View) ### view.attachTo([$el], [options]) ⇒ Promise

If detached, will replace the element passed in with this view's element and activate the view.

**Kind**: instance method of [View](#View) **Returns**: Promise -

promise that when resolved, the attach process is complete. Normally this method is synchronous. Transition effects can
make it asynchronous.

| Param | Type | Default | Description | | --- | --- | --- | --- | | [$el] | [jQuery](#external_jQuery) | |

the element to attach to. This element will be replaced with this view.
If options.replaceMethod is provided, then this parameter is ignored.

| | [options] | Object | |

optional options

| | [options.replaceMethod] | Fucntion | |

if given, this view will invoke replaceMethod function
in order to attach the view's DOM to the parent instead of calling $el.replaceWith

| | [options.discardInjectionSite] | Booleon | false |

if set to true, the injection site is not saved.

| ### view.attachView($el, view, [options]) ⇒ Promise

Registers the view as a tracked view (defaulting as a child view), then calls view.attachTo with the element argument
The element argument can be a String that references an element with the corresponding "inject" attribute.
When using attachView with options.useTransition:
Will inject a new view into an injection site by using the new view's transitionIn method. If the parent view
previously had another view at this injections site, this previous view will be removed with that view's transitionOut.
If this method is used within a render, the current views' injection sites will be cached so they can be transitioned out even
though they are detached in the process of re-rendering. If no previous view is given and none can be found, the new view is transitioned in regardless.
If the previous view is the same as the new view, it is injected normally without transitioning in.
The previous view must has used an injection site with the standard "inject=" attribute to be found.
When the transitionIn and transitionOut methods are invoked on the new and previous views, the options parameter will be passed on to them. Other fields
will be added to the options parameter to allow better handling of the transitions. These include:
{
newView: the new view
previousView: the previous view (can be undefined)
parentView: the parent view transitioning in or out the tracked view
}</p> **Kind**: instance method of [View](#View) **Returns**: Promise -

resolved when all transitions are complete. No payload is provided upon resolution. If no transitions, then returns a resolved promise.

| Param | Type | Default | Description | | --- | --- | --- | --- | | $el | [jQuery](#external_jQuery) \| string | |

the element to attach to OR the name of the injection site. The element with the attribute "inject=" will be used.</p> | | view | [View](#View) | |

The instantiated view object to be attached

| | [options] | Object | |

optionals options object. If using transitions, this options object will be passed on to the transitionIn and transitionOut methods as well.

| | [options.noActivate] | boolean | false |

if set to true, the view will not be activated upon attaching.

| | [options.shared] | boolean | false |

if set to true, the view will be treated as a shared view and not disposed during parent view disposing.

| | [options.useTransition] | boolean | false |

if set to true, this method will delegate attach logic to this.__transitionNewViewIntoSite

| | [options.addBefore] | boolean | false |

if true, and options.useTransition is true, the new view's element will be added before the previous view's element. Defaults to after.

| | [options.previousView] | [View](#View) | |

if using options.useTransition, then you can explicitly define the view that should be transitioned out.
If using transitions and no previousView is provided, it will look to see if a view already is at this injection site and uses that by default.

| ### view.attachTrackedViews() ⇒ Promise \| Array.<Promise>

Hook to attach all your tracked views. This hook will be called after all DOM rendering is done so injection sites should be available.
This method can be overwritten as usual OR extended using .prototype.attachTrackedViews.apply(this, arguments);</p> **Kind**: instance method of [View](#View) **Returns**: Promise \| Array.<Promise> -

you can optionally return one or more promises that when all are resolved, all tracked views are attached. Useful when using this.attachView with useTransition=true.

### view.\_attached()

Method to be invoked when the view is fully attached to the DOM (NOT just the parent). Use this method to manipulate the view
after the DOM has been attached to the document. The default implementation is a no-op.

**Kind**: instance method of [View](#View) ### view.isAttachedToParent() ⇒ boolean **Kind**: instance method of [View](#View) **Returns**: boolean -

true if the view is attached to a parent

### view.isAttached() ⇒ boolean

NOTE: depends on a global variable "document"

**Kind**: instance method of [View](#View) **Returns**: boolean -

true if the view is attached to the DOM

### view.detach()

If attached, will detach the view from the DOM.
This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach
callback on each tracked view recursively.

**Kind**: instance method of [View](#View) ### view.detachTrackedViews([options])

Detach all tracked views or a subset of them based on the options parameter.
NOTE: this is not recursive - it will not separate the entire view tree.

**Kind**: instance method of [View](#View) | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, detach only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, detach only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### view.\_detached()

Method to be invoked when the view is detached from the DOM (NOT just the parent). Use this method to clean up state
after the view has been removed from the document. The default implementation is a no-op.

**Kind**: instance method of [View](#View) ### view.activate()

Resets listeners and events in order for the view to be reattached to the visible DOM

**Kind**: instance method of [View](#View) ### view.\_activate()

Method to be invoked when activate is called. Use this method to turn on any
custom timers, listenTo's or on's that should be activatable. The default implementation is a no-op.

**Kind**: instance method of [View](#View) ### view.isActive() ⇒ boolean **Kind**: instance method of [View](#View) **Returns**: boolean -

true if the view is active

### view.deactivate()

Maintains view state and DOM but prevents view from becoming a zombie by removing listeners
and events that may affect user experience. Recursively invokes deactivate on child views

**Kind**: instance method of [View](#View) ### view.\_deactivate()

Method to be invoked when deactivate is called. Use this method to turn off any
custom timers, listenTo's or on's that should be deactivatable. The default implementation is a no-op.

**Kind**: instance method of [View](#View) ### view.dispose()

Removes all listeners, disposes children views, stops listening to events, removes DOM.
After dispose is called, the view can be safely garbage collected. Called while
recursively removing views from the hierarchy.

**Kind**: instance method of [View](#View) ### view.\_dispose()

Method to be invoked when dispose is called. By default calling dispose will remove the
view's element, its on's, listenTo's, and any registered children.
Override this method to destruct any extra

**Kind**: instance method of [View](#View) ### view.isDisposed() ⇒ boolean **Kind**: instance method of [View](#View) **Returns**: boolean -

true if the view was disposed

### view.hasTrackedViews([options]) ⇒ boolean **Kind**: instance method of [View](#View) **Returns**: boolean -

true if this view has tracked views (limited by the options parameter)

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, only check the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, only check the child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### view.getTrackedViews([options]) ⇒ [List.<View>](#View)

Returns all tracked views, both child views and shared views.

**Kind**: instance method of [View](#View) **Returns**: [List.<View>](#View) -

all tracked views (filtered by options parameter)

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, get only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, get only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### view.getTrackedView(viewCID) ⇒ **Kind**: instance method of [View](#View) **Returns**:

the view with the given cid. Will look in both shared and child views.

| Param | Type | Description | | --- | --- | --- | | viewCID | string |

the cid of the view

| ### view.registerTrackedView(view, [options]) ⇒ [View](#View)

Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will
be done to the tracked view as well. Except dispose for shared views. This method defaults to register the
view as a child view unless specified by options.shared.

**Kind**: instance method of [View](#View) **Returns**: [View](#View) -

the tracked view

| Param | Type | Default | Description | | --- | --- | --- | --- | | view | [View](#View) | |

the tracked view

| | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, registers view as a shared view. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed. If false, registers view as a child view which are disposed when the parent is disposed.

| ### view.unregisterTrackedView(view) ⇒ [View](#View)

Unbinds the tracked view - no recursive calls will be made to this shared view

**Kind**: instance method of [View](#View) **Returns**: [View](#View) -

the tracked view

| Param | Type | Description | | --- | --- | --- | | view | [View](#View) |

the shared view

| ### view.unregisterTrackedViews([options]) ⇒ [View](#View)

Unbinds all tracked view - no recursive calls will be made to this shared view
You can limit the types of views that will be unregistered by using the options parameter.

**Kind**: instance method of [View](#View) **Returns**: [View](#View) -

the tracked view

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | {} |

Optional options.

| | [options.shared] | boolean | false |

If true, unregister only the shared views. These are views not owned by this parent. As compared to a child view
which are disposed when the parent is disposed.

| | [options.child] | boolean | false |

If true, unregister only child views. These are views that are owned by the parent and dispose of them if the parent is disposed.

| ### view.transitionOut(done, options)

Override to provide your own transition out logic. Default logic is to just detach from the page.
The method is passed a callback that should be invoked when the transition out has fully completed.

**Kind**: instance method of [View](#View) | Param | Type | Description | | --- | --- | --- | | done | function |

callback that MUST be invoked when the transition is complete.

| | options | |

optionals options object

| | options.currentView | [View](#View) |

the view that is being transitioned in.

| | options.previousView | [View](#View) |

the view that is being transitioned out. Typically this view.

| | options.parentView | [View](#View) |

the view that is invoking the transition.

| ### view.transitionIn(attach, done, options)

Override to provide your own transition in logic. Default logic is to just attach to the page.
The method is passed a callback that should be invoked when the transition in has fully completed.

**Kind**: instance method of [View](#View) | Param | Type | Description | | --- | --- | --- | | attach | function |

callback to be invoked when you want this view to be attached to the dom.
If you are trying to transition in a tracked view, consider using this.transitionInView()

| | done | function |

callback that MUST be invoked when the transition is complete.

| | options | |

optionals options object

| | options.currentView | [View](#View) |

the view that is being transitioned in.

| | options.previousView | [View](#View) |

the view that is being transitioned out. Typically this view.

| | options.parentView | [View](#View) |

the view that is invoking the transition.

| ### view.invokeFeedback(to, [evt], [indexMap])

Invokes a feedback entry's "then" method

**Kind**: instance method of [View](#View) | Param | Type | Description | | --- | --- | --- | | to | string |

the "to" field corresponding to the feedback entry to be invoked.

| | [evt] | Event |

the event to be passed to the "then" method

| | [indexMap] | Object |

a map from index variable name to index value. Needed for "to" fields with array notation.

| ## history ⇐ [Backbone-History](#external_Backbone-History) **Kind**: global class **Extends**: [Backbone-History](#external_Backbone-History) **See**: history Annotated Source **Author**: kent.willis@vecna.com ### new history()

Backbone's history object.

## registry ⇐ [Backbone-Events](#external_Backbone-Events) **Kind**: global class **Extends**: [Backbone-Events](#external_Backbone-Events) **See**: registry Annotated Source **Author**: jyoung@vecna.com * [registry](#registry) ⇐ [Backbone-Events](#external_Backbone-Events) * [new registry()](#new_registry_new) * [.cells](#registry+cells) : Object.<string, Cell> * [.models](#registry+models) : Object.<string, Model> * [.services](#registry+services) : Object.<string, ServiceCell> * [.views](#registry+views) : Object.<string, View> * [.cidPrefix](#registry+cidPrefix) : string * [.modelInitialized(model)](#registry+modelInitialized) * [.cellInitialized(cell)](#registry+cellInitialized) * [.viewInitialized(view)](#registry+viewInitialized) * [.serviceInitialized(service)](#registry+serviceInitialized) * [.disposeAll()](#registry+disposeAll) * [.disposeAllModels()](#registry+disposeAllModels) * [.disposeAllCells()](#registry+disposeAllCells) * [.disposeAllServices()](#registry+disposeAllServices) * [.disposeAllViews()](#registry+disposeAllViews) ### new registry()

Registry of instantiated Torso objects

### registry.cells : Object.<string, Cell>

The registered cells keyed by their unique cid.

**Kind**: instance property of [registry](#registry) ### registry.models : Object.<string, Model>

The registered models keyed by their unique cid.

**Kind**: instance property of [registry](#registry) ### registry.services : Object.<string, ServiceCell>

The registered services keyed by their unique cid.

**Kind**: instance property of [registry](#registry) ### registry.views : Object.<string, View>

The registered views keyed by their unique cid.

**Kind**: instance property of [registry](#registry) ### registry.cidPrefix : string

The prefix to use for this object's cid.

**Kind**: instance property of [registry](#registry) ### registry.modelInitialized(model)

Add the model to the model cache when it is initialized.

**Kind**: instance method of [registry](#registry) | Param | Type | Description | | --- | --- | --- | | model | Torso.Model |

the model to add to the models cache.

| ### registry.cellInitialized(cell)

Add the cell to the cell cache when it is initialized.

**Kind**: instance method of [registry](#registry) | Param | Type | Description | | --- | --- | --- | | cell | Torso.Cell |

the cell to add to the cells cache.

| ### registry.viewInitialized(view)

Add the view to the view cache when it is initialized.

**Kind**: instance method of [registry](#registry) | Param | Type | Description | | --- | --- | --- | | view | Torso.View |

the view to add to the views cache.

| ### registry.serviceInitialized(service)

Add the service to the model service when it is initialized.

**Kind**: instance method of [registry](#registry) | Param | Type | Description | | --- | --- | --- | | service | Torso.ServiceCell |

the service to add to the services cache.

| ### registry.disposeAll()

Dispose of all items in all of the caches (Models, Cells, Services and Views).

**Kind**: instance method of [registry](#registry) ### registry.disposeAllModels()

Dispose of all items in the Models cache.

**Kind**: instance method of [registry](#registry) ### registry.disposeAllCells()

Dispose of all items in the Cells cache.

**Kind**: instance method of [registry](#registry) ### registry.disposeAllServices()

Dispose of all items in the Services cache.

**Kind**: instance method of [registry](#registry) ### registry.disposeAllViews()

Dispose of all items in the Views cache.

**Kind**: instance method of [registry](#registry) ## DataBehavior ⇐ [Behavior](#Behavior) **Kind**: global class **Extends**: [Behavior](#Behavior) **See** - DataBehavior Annotated Source - Detailed docs for more in-depth documentation and details. **Author**: jyoung@vecna.com * [DataBehavior](#DataBehavior) ⇐ [Behavior](#Behavior) * [new DataBehavior()](#new_DataBehavior_new) * _instance_ * [.alias](#Behavior+alias) : string * [.cidPrefix](#Behavior+cidPrefix) : string * [.mixin](#Behavior+mixin) : Object * [.prepare()](#Behavior+prepare) ⇒ Object * [._dispose()](#Behavior+_dispose) * [.isDisposed()](#Behavior+isDisposed) ⇒ boolean * _static_ * [.cache](#DataBehavior.cache) * [.renderOnFetch](#DataBehavior.renderOnFetch) * [.skipInitialLoad](#DataBehavior.skipInitialLoad) * [.returnSingleResult](#DataBehavior.returnSingleResult) * [.alwaysFetch](#DataBehavior.alwaysFetch) * [.ids](#DataBehavior.ids) * [.updateEvents](#DataBehavior.updateEvents) * [.data](#DataBehavior.data) * [.FETCHED_STATUSES](#DataBehavior.FETCHED_STATUSES) * [.constructor([behaviorState], behaviorOptions, [viewOptions])](#DataBehavior.constructor) * [.retrieve()](#DataBehavior.retrieve) ⇒ $.Deferred.Promise * [.pull()](#DataBehavior.pull) ⇒ $.Deferred.Promise * [.fetch()](#DataBehavior.fetch) ⇒ $.Deferred.Promise * [.prepare()](#DataBehavior.prepare) * [.isLoading()](#DataBehavior.isLoading) ⇒ boolean * [.isLoadingIds()](#DataBehavior.isLoadingIds) ⇒ boolean * [.isLoadingObjects()](#DataBehavior.isLoadingObjects) ⇒ boolean * [.listenToIdsPropertyChangeEvent()](#DataBehavior.listenToIdsPropertyChangeEvent) * [.stopListeningToIdsPropertyChangeEvent()](#DataBehavior.stopListeningToIdsPropertyChangeEvent) * [.retrieveOncePromise()](#DataBehavior.retrieveOncePromise) ⇒ [jQuery-Deferred](#external_jQuery-Deferred) * _inner_ * [~Data](#DataBehavior..Data) * [new Data()](#new_DataBehavior..Data_new) ### new DataBehavior()

This behavior implements simplified interaction with data sources (i.e. TorsoCollection).
This behavior manages re-rendering when data changes and automatically adding the returned data to the view's context.
This behavior also manages dependencies between data and other objects to allow intelligent re-fetching when data changes.

### dataBehavior.alias : string

Unique name of the behavior instance w/in a view. More human readable than the cid.

**Kind**: instance property of [DataBehavior](#DataBehavior) ### dataBehavior.cidPrefix : string

cidPrefix of Behaviors

**Kind**: instance property of [DataBehavior](#DataBehavior) ### dataBehavior.mixin : Object

Add functions to be added to the view's public API. They will be behavior-scoped.

**Kind**: instance property of [DataBehavior](#DataBehavior) ### dataBehavior.prepare() ⇒ Object

The behavior's prepare result will be combined with the view's prepare with the behavior's alias as the namespace.
effectively: { [behaviorName]: behavior.prepare() } will be combined with the view's prepare result.

**Kind**: instance method of [DataBehavior](#DataBehavior) **Returns**: Object -

a prepare context suitable to being added to the view's prepare result.

### dataBehavior.\_dispose()

Method to be invoked when dispose is called. By default calling dispose will remove the
behavior's on's and listenTo's.
Override this method to destruct any extra

**Kind**: instance method of [DataBehavior](#DataBehavior) ### dataBehavior.isDisposed() ⇒ boolean **Kind**: instance method of [DataBehavior](#DataBehavior) **Returns**: boolean -

true if the view was disposed

### DataBehavior.cache

The torso collection that is acting as a cache used to create the private collections.
This property/option is required. Instantiation will fail if it is not set.

**Kind**: static property of [DataBehavior](#DataBehavior) **Properties** | Name | Type | | --- | --- | | cache | [Collection](#Collection) | ### DataBehavior.renderOnFetch

Adds a listener on the Behavior for the fetched event that triggers a render on the view.
true - A listener is added to the behavior that re-renders the view when a 'fetched' event is triggered.
false (default) - no listeners are added.

**Kind**: static property of [DataBehavior](#DataBehavior) **Default**: false **Properties** | Name | Type | | --- | --- | | renderOnFetch | boolean | ### DataBehavior.skipInitialLoad

Skip triggering a load of this data behavior when the view completes initializing.
true - no load after the view is initialized.
false (default) - trigger a .retrieve() on this data behavior when the view completes initialization.

**Kind**: static property of [DataBehavior](#DataBehavior) **Default**: false **Properties** | Name | Type | | --- | --- | | skipInitialLoad | boolean | ### DataBehavior.returnSingleResult

Determines the result of view.getBehavior('thisBehaviorAlias').toJSON().
true - a single model result is returned.
false (default) - an array of model results are returned.

**Kind**: static property of [DataBehavior](#DataBehavior) **Default**: false **Properties** | Name | Type | | --- | --- | | returnSingleResult | boolean | ### DataBehavior.alwaysFetch

Determines whether pull() or fetch() is called when using retrieve().
true - Use fetch() by default on the private collection.
false (default) - Use pull() by default on the private collection.
True will query the server more often, but will provide more up-to-date data.
False will only query the server if the model hasn't already been retrieved.
This property will be ignored if fetch() or pull() is called directly.

**Kind**: static property of [DataBehavior](#DataBehavior) **Default**: false **Properties** | Name | Type | | --- | --- | | alwaysFetch | boolean | ### DataBehavior.ids

Duck-typed property that identifies the ids to use. id or ids is required (either by behavior options or as properties).