Skip to content

Instantly share code, notes, and snippets.

@zainozzaini
Last active January 19, 2018 02:58
Show Gist options
  • Save zainozzaini/4793368a00f1398a10177a7e67a69bc8 to your computer and use it in GitHub Desktop.
Save zainozzaini/4793368a00f1398a10177a7e67a69bc8 to your computer and use it in GitHub Desktop.
Promises
test = ()=> {
return new Promise((resolve,reject)=>{
try{
setTimeout(()=> {resolve('Hello')},10000);
}catch(e){
reject('error')
}
})
}
requestCases = async () =>{
let hello = await this.test();
return hello;
}
...
this.requestCases().then((value)=>console.log(value));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment