eventmaster

A simple, compact and consistent implementation that provides both Promise/Deferred/Flow pattern and Event/Notify/Observer/PubSub pattern

npm install eventmaster
2 downloads in the last week
8 downloads in the last month

EventMaster

  • A simple, compact and consistent implementation of a variant of CommonJS's Promises and Events
  • Provide both Promise/Deferred/Flow pattern and Event/Notify/Observer/PubSub pattern

In NodeJS

npm install eventmaster

In browser

AMD and OzJS

Get the Code

Dependencies

Examples

API and usage

var Event = require('eventmaster');
  • Event(opt) --
  • Event.Promise(opt) --
  • Event.Event(opt) --
  • Event.when(promise, promise, ...) --
  • Event.pipe(prev, next) --
var event = Event();
  • event.promise(subject) --
  • event.when(subject, subject, ...) --
  • event.once(subject, callback, errorCallback) --
  • event.done(subject, callback) --
  • event.fail(subject, callback) --
  • event.cancel(subject, callback, errorCallback) --
  • event.bind(subject, callback) --
  • event.unbind(subject, callback) --
  • event.on() -- alias for event.bind
  • event.off() -- alias for event.unbind
  • event.progress(subject, callback) --
  • event.notify(subject, [arg, arg, ...]) --
  • event.fire(subject, [arg, arg, ...]) --
  • event.error(subject, [arg, arg, ...]) --
  • event.resolve(subject, [arg, arg, ...]) --
  • event.reject(subject, [arg, arg, ...]) --
  • event.reset(subject) --
  • event.disable(subject) --
  • event.enable(subject) --
var promise = Event.Promise();
  • promise.then(callback, errorCallback) --
  • promise.done(callback) --
  • promise.fail(callback) --
  • promise.cancel(callback, errorCallback) --
  • promise.bind(callback) --
  • promise.unbind(callback) --
  • promise.progress() --
  • promise.notify() --
  • promise.fire([arg, arg, ...]) --
  • promise.error([arg, arg, ...]) --
  • promise.resolve([arg, arg, ...]) --
  • promise.reject([arg, arg, ...]) --
  • promise.reset() --
  • promise.disable() --
  • promise.enable() --
  • promise.merge() --
  • promise.follow() --
  • promise.end() --
  • promise.all() --
  • promise.any() --
  • promise.some() --
  • promise.pipe.fire(arg, arg, ...) --
  • promise.pipe.error(arg, arg, ...) --
  • promise.pipe.notify() --
  • promise.pipe.resolve(arg, arg, ...) --
  • promise.pipe.reject(arg, arg, ...) --
  • promise.pipe.disable() --
  • promise.pipe.enable() --
  • promise.pipe.reset() --

Under construction...

More References

See OzJS Project Homepage

Release History

See OzJS Release History

License

Copyright (c) 2010 - 2013 dexteryy
Licensed under the MIT license.

npm loves you