RSVP

RSVP : A lightweight library that provides tools for organizing asynchronous code.

This module gives a tiny implementation of Promises/A+.

As usual do a npm install rsvp to get the module.

Basic Usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
var RSVP = require('rsvp');

var promise = new RSVP.Promise(function(resolve, reject) {
  // succeed
  resolve(value);
  // or reject
  reject(error);
});

promise.then(function(value) {
  // success
}, function(value) {
  // failure
});

Once a promise has been resolved or rejected, it cannot be resolved or rejected again.

It give some more goddies like:

  • Chaining

  • Easy Error Handling.

  • Compatible with TaskJS.

So, what are you waiting for? Go got it and have fun!

Suggest a module

Comments