Created
April 9, 2022 00:10
-
-
Save KenoLeon/64a583728f0d0df91159e4bca7bb90ed to your computer and use it in GitHub Desktop.
prototypical async function with await operator
This file contains hidden or 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
| function EVM_OPERATION() { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve('Done with Operation'); | |
| // uncomment this and comment the resolve to test the catch block | |
| // reject('Something went wrong'); | |
| }, 600); | |
| }); | |
| } | |
| async function callEVM() { | |
| console.log('Sending transaction to EVM'); | |
| try { | |
| const result = await EVM_OPERATION(); | |
| console.log(result); | |
| } | |
| catch (err) { | |
| console.log(err); | |
| } | |
| } | |
| callEVM(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment