promissum

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

Promissum

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

Documentation can be found in the source.

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.");
  });

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>
  • 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.

Promissum in the npm registy.

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

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

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

npm test

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