Skip to content
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


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.


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.