An implementation of Promise then with ES3 syntax
JavaScript HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
README.md
package.json

README.md

Promise library targeting ES3

"Promises/A+ logo"

Description

This is simply an implementation of the then function, just for learning.
It is written with ES3 syntax.
setTimeout is used to ensure asynchronous flow.

Contrary to many other implementations, here a promise object only exposes status, value and resolve properties. No internal properties are exposed. Instead, an enhanced promise object is created for every promise and a register links the promise to its enhanced promise.
At the moment the register is a simple array and this data structure should be replaced in a future better performing version.

Promises/A+ compliance tests

npm run test

Note

Command used to generate minified file

.node_modules/uglify-js/bin/uglifyjs src/promise.js --support-ie8 --compress --output src/promise.min.js