Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
backbone-fsm
Advanced tools
Finite-State Machine for Backbone views and models. Browser and Node.js compatible.
bower install backbone-fsm
Include lib/backbone-fsm.js
into your page.
npm install backbone-fsm
FSM
comes with mixin
method. You have to extend this
during initialization.
var Foo = Backbone.View.extend({
initialize: function () {
FSM.mixin(this);
}
});
You can define transitions
and defaultState
:
var Foo = Backbone.View.extend({
initialize: function () {
FSM.mixin(this);
},
defaultState: 'firstState',
transitions: {
'transitionName': {
from: 'firstState',
to: 'secondState'
}
},
onTransitionName: function (callback) {
callback();
}
});
To make a transition run transitionTo("secondState")
.
During transition:
transition:start
event is emitedonTransitionName
callback is called (if defined).transition:stop
event is emitedBackbone-FSM live example: http://jsfiddle.net/fragphace/Zc6Gx/
For server-side tests:
npm test
Browser tests can be found in test/browser.html
.
Tested under:
make coffee
make watch
FAQs
Finite-State Machine for Backbone views and models.
We found that backbone-fsm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.