promissum

Promissum is a JavaScript library that provides promises with the semantics and terminology described in the Promises/A+ specification.

npm install promissum
1 downloads in the last week
4 downloads in the last month

Promissum

Promissum is a JavaScript library that provides promises with the semantics and terminology described in the Promises/A+ specification.

Usage

Documentation can be found in the source.

Example

var sleep = function (s) {
  var p = promise();
  setTimeout(function () {
    p.fulfill(s);
  }, s * 1000);
  return p;
};

sleep(3)
  .then(function (s) {
    console.log("Slept for " + s + " seconds.");
  });

Installation

Before you download the library, you can try it out in your browser. Go to the following URL and open the JavaScript console.

data:text/html,<script src="https://raw.github.com/andreaslundahl/promissum/v0.1.0/src/promissum.js"></script>

Web browser

  • Version 0.1.0 for development.
  • Version 0.1.0 for production (minified).
  • HEAD of the master branch.

Once included, the promise function is added to window.

npm

Promissum in the npm registy.

Once installed, the promise function can be required with require("promissum").

Dependencies

  • A JavaScript environment (e.g. a web browser or Node.js).
  • The promises-aplus-tests library (for testing).

Tests

Currently, the test suite can only be run on Node.js. After you have installed it, get the source code and run:

npm test

Alternatives

License

Copyright (c) 2013 Andreas Lundahl. Promissum may be freely distributed under the MIT license. More information can be found in the LICENSE file.

npm loves you