Promises/A+ library “Ten.Promise” 0.1.0 Released

We released the first version of Ten.Promise on 6 February 2013.

What is Ten.Promise?

Ten.Promise is a JavaScript Promises/A+ library written in TypeScript. Using this library, you can make asynchronous (or async) patterns easier. See following page to know about Promises/A+.

As the Promises/A+ specification defines an interface of a promise object and how a promise object treats other promise object, Ten.Promise will work along with other Promises/A+ implementations well.

Where Ten.Promise works

We made sure that Ten.Promise work on following JavaScript processing environment:

We couldn't check on other environments.

Our aim

We aim to let Ten.Promise be a Promises/A+ library having interface-level compatibility with following libraries:

Current status

Ten.Promise 0.1.0 passes all of the Promises/A+ tests (version 1.2.0).

And a part of a WinJS.Promise interface is implemented. Implemented constructor and methods are just shown below.

Big difference between WinJS.Promise and Ten.Promise

These two libraries have difference in the timing of the call of callback functions which are registered with a promise object already fulfilled (or rejected) by its then method:

  • A promise object already fulfilled (or rejected) of WinJS.Promise calls a callback function just registered by then method before returning from the method;
  • A promise object already fulfilled (or rejected) of Ten.Promise return from then method before a callback function is called.

Ten.Promise is compliant to the Promises/A+ specification, while WinJS.Promise is not.


<script src="Ten.Promise.js"></script>
// create promise object
var p = new Ten.Promise(function (s,e,p) {
    var count = 0;
    var timerId;
    function timer() {
        setTimeout(function () {
            if (count < 5) {
            } else {
        }, 4000);
// register callback functions
    function onSuccess(val) { // it is called one time (value: 5)
        console.log("success callback: " + val);
    function onError(err) {}, // in this example, this will not be called
    function onProgress(val) { // it is called four times (respective values: 1, 2, 3, 4)
        console.log("progress callback: " + val);