0.3.2 • Published 8 years ago

kinopromise v0.3.2

Weekly downloads
13
License
MIT
Repository
github
Last release
8 years ago

KinoPromise

Build Status

A bit of sugar on top of native ES2015 Promises. KinoPromise inherits from pinkie promise polyfill in node 0.10, node 0.12 and io.js even if global.Promise is available. This is because of the fact that extending via node's util.inherits probably doesn't work for native promises.

API

KinoPromise.prototype.spread

KinoPromise.all([
    new KinoPromise(function (resolve) { resolve(1) }),
    new KinoPromise(function (resolve) { resolve(2) })
]).spread(function (one, two) {
    assert.equal(one, 1); // true
    assert.equal(two, 2); // true
});

KinoPromise.all with an object passing

KinoPromise.all({
    foo: new KinoPromise(function (resolve) { resolve(1) }),
    bar: new KinoPromise(function (resolve) { resolve(2) })
}).then(function (res) {
    assert(res.foo, 1) // true
    assert(res.bar, 2) // true
});

Prototype inheritance

var promise = new KinoPromise(function () {});
promise instanceof Promise // true
0.3.2

8 years ago

1.0.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago