Skip to content

Instantly share code, notes, and snippets.

@shrunyan
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrunyan/69ddbee381eab98e1d06 to your computer and use it in GitHub Desktop.
Save shrunyan/69ddbee381eab98e1d06 to your computer and use it in GitHub Desktop.
Playing around with ES6 Promises
'use strict'
let promise = new Promise(function (resolve, reject) {
// Do shiz
if (false) {
reject(new Error('fucked up'))
} else {
resolve('true')
}
})
promise
.then(function (res) {
console.log(res)
})
.catch(function (err) {
console.log(err)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment