bb-multi-events
v0.1.6
Published
Backbone multiple events catcher
Downloads
1
Readme
bb-multi-events
Simple example:
var _ = require('underscore'),
Events = require('backbone').Events;
var onAll = require('bb-multi-events/on_all');
var view = _.extend({}, Events),
collection = _.extend({}, Events);
onAll({ 'animation-complete': view, 'sync': collection }, { 'render-page': view }, () => {
console.log('render page after animation and sync collection'); // [1]
});
view.trigger('animation-complete');
collection.trigger('sync'); // will trigger the =>[1] statement
view.trigger('animation-complete');
view.trigger('render-page'); // will clean the events stack
collection.trigger('sync');
view.trigger('animation-complete'); // will trigger the =>[1] statement
Instalation:
$ jspm install npm:bb-multi-events
$ npm install bb-multi-events