Skip to content

Commit

Permalink
Add timer async function example
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamingr authored Apr 19, 2017
1 parent 0aaea4a commit 07acf08
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/api/timers.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ setImmediatePromise('foobar').then((value) => {
// value === 'foobar' (passing values is optional)
// This is executed after all I/O callbacks.
});

// or with async function
async function timerExample() {
console.log("Before I/O callbacks");
await setImmediatePromise();
console.log("After I/O callbacks");
}
timerExample();
```

### setInterval(callback, delay[, ...args])
Expand Down

0 comments on commit 07acf08

Please sign in to comment.