p-queue icon indicating copy to clipboard operation
p-queue copied to clipboard

PQueue has no `on` method

Open jgusta opened this issue 4 months ago • 0 comments

const queue = new PQueue({
  concurrency: 10,
})

queue.on("next", async () => {console.log('next')})

throw the error:

error: Uncaught (in promise) TypeError: queue.on is not a function

The readme seems to have been taken from the node version. The on method exists on Node's EventEmitter, but in this Deno version, this has been swapped out for EventTarget which has no on method. This package should either bring in Node's EventEmitter (import { EventEmitter } from 'node:events';) or the README should be adjusted to use addEventListener instead of on.

jgusta avatar Sep 18 '25 06:09 jgusta