rsvp-backlog
v0.2.0
Published
Like RSVP.all() but a little smarter
Downloads
1
Readme
rsvp-backlog
var backlog = RSVP.createBacklog();
backlog.add(somePromise);
// Access a promise in the backlog directly
backlog.toArray()[0].then(doSomething);
// The promise behind .whenClear() resets when the backlog size goes from zero
// to one, so you need at least one promise before you can call it
backlog.whenClear().then(doSomethingElse);
// Callback functions can be passed to handle additions, removals and
// resolutions
backlog.whenChanged(function () {
// The callback is bound to the backlog
renderBacklogProgress(this.toArray().length);
});
// Resolving or removing the last promise in the backlog resolves the backlog
// as a whole
backlog.remove(somePromise);
Bower installation
From a terminal:
bower install rsvp-backlog
In your HTML:
<script src="bower_components/rsvp-backlog/rsvp-backlog.min.js">
Node installation
From a terminal:
npm install rsvp-backlog
In your script:
var createBacklog = require('rsvp-backlog'),
backlog = createBacklog();