News for hackers. Stuff that matters.
Re:V8 adds support for top-level await by tlrobinson on Wednesday September 25, 2019 @12:31AM (#21067616)
How about an `updateBalance(updateFn)` that is protected by a mutex:

    async function deduct(amt) {
      await updateBalance(balance => {
        if (balance >= amt) {
          return balance - amt;
        } else {
          throw new Error("not enough balance");
      })
    }

There are no comments on this comment yet.