O'Reilly logo

Backbone.js Cookbook by Vadim Mirgorod

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing workflow for a model

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.

Getting ready

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 index.html.

Note

Including a Backbone extension into your project is described in the Extending application with plugins recipe in Chapter 1, Understanding Backbone in detail.

How to do it...

Let's create a workflow for InvoiceModel ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required