0.1.0 • Published 13 years ago
promissum v0.1.0
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
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 testAlternatives
License
Copyright (c) 2013 Andreas Lundahl. Promissum may be freely distributed under the MIT license. More information can be found in the LICENSE file.
0.1.0
13 years ago