Created
November 18, 2013 08:54
-
-
Save kadukf/7524746 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
// EXAMPLE 1 | |
var promise = new WinJS.Promise(function (completeCallback, errorCallback) { | |
// do some async operation | |
// if completed properly, call completeCallback() | |
// otherwise call errorCallback(error) | |
}); | |
//EXAMPLE 2 | |
// extenally managed promise | |
var complete; | |
var error; | |
var promise = new WinJS.Promise(function (completeCallback, errorCallback) { | |
complete = completeCallback; | |
error = errorCallback; | |
}); | |
// do some async operation | |
// if completed properly, call complete() => which completes the promise | |
// otherwise call error(error) => which errors the promise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment