Skip to content

Instantly share code, notes, and snippets.

@graup
Created November 26, 2018 05:09
Show Gist options
  • Save graup/bfbc5c1036724300e7bd12ae7f77c371 to your computer and use it in GitHub Desktop.
Save graup/bfbc5c1036724300e7bd12ae7f77c371 to your computer and use it in GitHub Desktop.

Revisions

  1. graup created this gist Nov 26, 2018.
    12 changes: 12 additions & 0 deletions timedAsync.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    try {
    const result = await timedAsync(originalAsyncFunction, {
    slow: () => {
    console.log('operation is slow and still going on'):
    },
    fast: () => {
    console.log('operation finished quickly'):
    }
    });
    } catch (e) {
    console.log('operation threw an exception');
    }