example/future.js
function(resolve, reject) {
                console.log(thisPromiseCount +
                    ') Promise started (Async code started)');
                // This only is an example to create asynchronism
                global.setTimeout(
                    function() {
                        // We fulfill the promise !
                        resolve(thisPromiseCount);
                    }, Math.random() * 2000 + 1000);
            }
function(resolve, reject) {
                console.log(thisPromiseCount +
                    ') Promise started (Async code started)');
                // This only is an example to create asynchronism
                global.setTimeout(
                    function() {
                        // We fulfill the promise !
                        resolve(thisPromiseCount);
                    }, Math.random() * 2000 + 1000);
            }
function ( resolve , reject ) { console . log ( thisPromiseCount + ') Promise started (Async code started)' ) ; // This only is an example to create asynchronism global . setTimeout ( function ( ) { // We fulfill the promise ! resolve ( thisPromiseCount ) ; } , Math . random ( ) * 2000 + 1000 ) ; }
The resolver function is called with the ability to resolve or reject the promise
The resolver function is called with the ability to resolve or reject the promise