BackboneJS, making an event-dispatching Object.

Written by - Saumya

01 February 2014

Making Views, Collections and Models in BackboneJS is as simple as extending the raw BackboneJS objects.

var MyView = Backbone.View.extend({});

Making a generic object and make it dispatch events is also kind of same, but then the syntax is a little different.

var myUtilLib = _.extend({},Backbone.Events);

Everything else remains the same, but then, this little syntax change for an event dispatching object may come in your way, if you are new to BackboneJS. Here is a detailed example of an utility class for BackboneJS.

Happy coding.