Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created June 4, 2015 03:40
Show Gist options
  • Select an option

  • Save ajcrites/236f5445eeb4f47d70df to your computer and use it in GitHub Desktop.

Select an option

Save ajcrites/236f5445eeb4f47d70df to your computer and use it in GitHub Desktop.
var aPromise = new Promise(function (resolve, reject) {
resolve("a promise");
});
aPromise
.then(returnAPromise)
.then(returnAValue)
.then(returnAPromise)
.catch(handleAnyError);
function returnAPromise(value) {
console.log(value);
return new Promise(function (resolve, reject) {
resolve(process.hrtime());
});
};
function returnAValue(value) {
console.log(value);
return process.hrtime();
}
function handleAnyError(error) {
console.log(error);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment