p
yet another A+ Promise (small enough to include in your own library)
Install via npm:
$ npm install ppromise --save
In addition to the specified A+ behavior:
var readJSON = { fs;}; readJSON
p
also implements Promise.all
:
PromiseallpromiseA promiseB promiseC;
and the creation of Deferred
s when passing no arguments to the constructor:
var dfd = ;var promise = dfd; // this will only contain the `then`fs;dfd
The library works as AMD or CommonJS module, or as a plain script tag (exporting to window.Promise
). If you'd like to get back the original window.Promise
(i.e. native implementations) you can use Promise.noConflict
:
var pPromise = Promise;console // => function(){ [native code] } (or undefined)
License
MIT © Frederik Ring