Skip to content

Instantly share code, notes, and snippets.

@garrettmac
Last active September 26, 2016 22:56
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 garrettmac/b30cd42031085c35e4ad24fca02aec80 to your computer and use it in GitHub Desktop.
Save garrettmac/b30cd42031085c35e4ad24fca02aec80 to your computer and use it in GitHub Desktop.
typescript promist
promiseExmple(){
return new Promise((resolve, reject) => {
setTimeout(()=>{reject('its been 5 sec')},5000)
});
}
/* ------------- */
this.user.promiseExmple().then((result)=>{
console.log("result: ",result)
}).catch((err)=>{
console.log("promise failed: ",err)
})
/* ------------- */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment