Standalone version of Backbone.Events
npm install backbone-events-standalonebackbone-events-standalone
==========================

This is an extraction of the [Events] module of [Backbone] which can be used
standalone (no external dependency), in the browser or in a nodejs environment.
This project started because I appreciate the Backbone.Events interface &
features while I wanted to keep using it within non-DOM environments (think a
[Social API Web Worker] for example).
I've ported the [original Backbone.Events tests] to [mocha] & [chai] so I can
run them within a [nodejs] environment and ensure the extracted API actually
works as expected without the burden of setting up continuous integration of
browser tests.
```
$ bower install backbone-events-standalone
``
$ npm install backbone-events-standalone
`html`
Notes:
- You may want to use the minified version stored in backbone-events-standalone.min.js.bower_components/backbone-events-standalone
- Using Bower, files are usually available within
`js`
require(["backbone-events-standalone"], function(BackboneEvents) {
// ...
});
`js`
var BackboneEvents = require("backbone-events-standalone");
The BackboneEvents#mixin method helps extending any object or prototype to add eventing
support to it:
`js
var myEventEmitter = BackboneEvents.mixin({});
myEventEmitter.on("foo", console.log).trigger("foo", "hello emitter");
// alternatively
function Plop() {}
BackboneEvents.mixin(Plop.prototype);
(new Plop()).on("foo", console.log).trigger("foo", "hello emitter");
`
BackboneEvents API & usage is the same as [Backbone.Events].
```
$ npm test
MIT
Jeremy Ashkenas, Backbone author
[Events]: http://backbonejs.org/#Events
[Backbone.Events]: http://backbonejs.org/#Events
[Backbone]: http://backbonejs.org/
[mocha]: (http://visionmedia.github.io/mocha/)
[chai]: http://chaijs.com/
[nodejs]: nodejs.org/
[original Backbone.Events tests]: https://github.com/jashkenas/backbone/blob/699fe3271262043bb137bae97bd0003d6d193f27/test/events.js
[Social API Web Worker]: https://developer.mozilla.org/en-US/docs/Social_API/Service_worker_API_reference