Last active
September 26, 2016 22:56
-
-
Save garrettmac/b30cd42031085c35e4ad24fca02aec80 to your computer and use it in GitHub Desktop.
typescript promist
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
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