TIL about Promise.withResolvers()
🔗 a link post linking to developer.mozilla.org
Seen on mastodon (@patak@webtoo.ls), I am excited to see that this old trick is being standardized:
let resolve, reject
const promise = new Promise((res, rej) => {
;[resolve, reject] = [res, rej]
})
I’ve been using deno’s standard library’s deferred for a while, and I’ll be happy to switch to Promise.withResolvers()
soon 💪