README
jsTools: Events
Installation
npm install events-wrapper --save
# alternatively you can use bower (minified version by default)
bower install events-wrapper --save
Usage
var obj = new Events();
obj.on('foo', function () {
flag = true;
});
obj.trigger('foo');
AngularJS Module
angular.module('myApp', ['jstools.events'])
.controller('AppCtrl', ['$scope', 'Events', function ($scope, Events) {
var obj = new Events();
obj.$on('foo', function () {
flag = true;
});
obj.$trigger('foo');
}]);