/q

Library for Promises/A+ in front end. Inspired by kriskowal/q, and much smaller.

Primary LanguageJavaScript

Q — library for promises Build Status

Promise/A+ is the specification what this implementation follow. It can be used in any allowed way under Promise/A+.

This implementation is quite small, and it is easy to merge into other code without introduction of redundant code. This is very helpful when developing a webapp.

Environments in which to use Q

  • Browser support
  • Nodejs
  • Browser extensions

Runing the Unit Tests

You need the necessary dependencies:

npm install

Run tests

npm test

Tutorial

Q(function(resolve, reject) {
    // Async or sync operation
    // success: resolve(val)
    // error: reject(reason)
}).then(function(val) {
    // onresolved
}, function(reason) {
    // onrejected
});

License

Copyright 2015–2016 Xiao-Bo Li MIT License