Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
backbone-machina
Advanced tools
machina.Fsm dressed as a fourth Backbone pillar next to Model, View and Router
machina.Fsm dressed as a fourth Backbone pillar next to Model, View and Router.
$ npm i backbone-machina
import BackboneFsm from 'backbone-machina';
const someFsm = new BackboneFsm({...});
someFsm.on('enter:someState', (fsm, action) => {...});
someFsm.on('exit:anotherState', (fsm, action) => {...});
BackboneFsm
is the default and only export of this package. It extends both machina.Fsm
and Backbone.Events
. In addition, it emits enter:stateName
and exit:stateName
events so you can hook into the behaviour of your FSM in the same way as you would do with Backbone.Model
et al. This fully describes the API.
New in version 1.1.0: BackboneFsm
is truly 100% compatible with both interfaces it extends. You can use '*'
and 'all'
interchangeably as wildcards when subscribing to events. machina.Fsm
’s eventListeners
option is supported as well. As a result, BackboneFsm
can now be used in hierarchical settings as a drop-in replacement for machina.Fsm
.
If you are using Backbone, then you already have some powerful tools at your disposal for managing (changes of) state:
Model
and Collection
for the state of your data;View
for the state of your document;Router
for the state of the URL that is shown in the browser.There is fourth type of state, however, that none of these classes captures very well. I would call this contextual state. Examples of contextual state include
Finite state machines are ideal for managing contextual state. There are many libraries out there that provide finite state machines, but I believe machina is the most declarative and also the most powerful of them all. To my knowledge, backbone-machina is the first library that marries Backbone and machina. Head to http://machina-js.org for some impressive examples of what a machina.Fsm
can do!
Head over to the wiki for some philosophy on Backbone project organization, which also discusses the place of BackboneFsm
in your project.
1.1.0 — 2020-02-10
eventListeners
option.'*'
event wildcard as an alternative for Backbone.Event's 'all'
. Both forms can now be used interchangeably.master
branch to production
and the develop
branch to master
.FAQs
machina.Fsm dressed as a fourth Backbone pillar next to Model, View and Router
The npm package backbone-machina receives a total of 3 weekly downloads. As such, backbone-machina popularity was classified as not popular.
We found that backbone-machina 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.