Created
February 1, 2014 18:51
-
-
Save kreshikhin/8756800 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Promise to be filled with future value | |
var futureValue = new Promise(); | |
// .then() will return a new promise | |
var anotherFutureValue = futureValue.then(); | |
// Promise state handlers ( must be a function ). | |
// The returned value of the fulfilled / failed handler will be the value of the promise. | |
futureValue.then({ | |
// Called if/when the promise is fulfilled | |
fulfilledHandler: function() {}, | |
// Called if/when the promise fails | |
errorHandler: function() {}, | |
// Called for progress events (not all implementations of promises have this) | |
progressHandler: function() {} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment