If you are implementing a business logic, which assumes that a model can be in different states and there are special rules applied to a state change, you should use the
workflow.js extension, which is very helpful for building such kind of functionality.
You can download the
workflow.js extension from the GitHub page https://github.com/kendagriff/workflow.js. To include this extension into your project, save the
workflow.js file into the
lib folder and include a reference to it in
Including a Backbone extension into your project is described in the Extending application with plugins recipe in Chapter 1, Understanding Backbone in detail.
Let's create a workflow for