pfeil

v0.1.1
Decently fast, mnimalistic Promises/A+ for node & the browser.
pfeil promise promise/a+ minimalist fast small Kb lightweight then and 1 more...

pfeil

A decently fast-ish, minimalistic Promises/A+ implementation in under 4Kb that works in the browser or in node.

###API###

####pfeil.defer()####

Returns a deferred object, comprised of a promise and resolve/reject methods that operate on that promise.

####{deferred}.resolve(value)####

Resolve {deferred}.promise with value.

####{deferred}.reject(reason)####

Reject {deferred}.promise with reason.

####{deferred}.promise.then(onFulfilled, onRejected)####

Add onFulfilled/onRejected handlers that will be called when the promise resolves.

These should take the form: function (x|e) {} where x|e is either the promise's value or rejection reason.

That's basically it.

Enjoy.

npm i pfeil

Metadata

  • MIT
  • Whatever
  • sterpe
  • released 1/24/2016

Downloads

Maintainers