Skip to content
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Backbone.setMode.js
README.md

README.md

Backbone.setMode

Backbone plugin: setMode. Forked from DocumentCloud

Makes the view enter a mode. Modes have both a 'mode' and a 'group', and are mutually exclusive with any other modes in the same group. Setting will update the view's modes hash, as well as set an HTML class of [mode]_[group] on the view's element. Convenient way to swap styles and behavior.

 Example:

myView.setMode('is', 'draggable');

// myView.el === '

' // myView.modes === {draggable: 'is'}

xxmyViewx.setMode('prompt', 'dialog'); myView.setMode('isnot', 'draggable');

// myView.el === '

' // myView.modes === {draggable: 'isnot', dialog: 'prompt'}

Something went wrong with that request. Please try again.