Behavior

Behavior

new Behavior(behaviorAttributes, behaviorOptions, viewOptionsopt)

Source:
Author:
  • deena.wang@vecna.com
See:

Allows abstraction of common view logic into separate object

Parameters:
Name Type Attributes Description
behaviorAttributes Object

the initial value of the behavior's attributes.

behaviorOptions Object
Properties
Name Type Description
view external:Backbone-View

that Behavior is attached to

alias string

the alias for the behavior in this view.

viewOptions Object <optional>

options passed to View's initialize

Members

alias :string

Source:

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

Type:
  • string

cidPrefix :string

Source:

cidPrefix of Behaviors

Type:
  • string

mixin :Object

Source:

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

Type:
  • Object

Methods

_dispose()

Source:

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

isDisposed() → {boolean}

Source:
Returns:

true if the view was disposed

Type
boolean

prepare() → {Object}

Source:

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.

Returns:

a prepare context suitable to being added to the view's prepare result.

Type
Object