Sk22

Sk22

1 total comment

  • Jan 28, 2026

    instead of

    const promise = new Promise((res) => (resolve = res));

    maybe

    const { promise, resolve: currentResolve } = Promise.withResolvers<void>() resolve = currentResolve;

    might be a bit more elegant? it's a bit more verbose, but your example ("extracting" the resolve function from the promise body) had me confused for a second. i think Promise.withResolvers might just be the right tool for that job; at least it doesn't feel like a hack :D

    (btw, i think i never really used javascript generators before. your buildQueue function might have just convinced me to try using one next time i get the chance!)