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

How do I remove a specific queue'd item?

Open CapitanRedBeard opened this issue 6 years ago • 2 comments

So say I queue up 5-10 async functions, then want to cancel maybe the fifth one. How would I go about doing that?

Looked through the code and couldn't find a remove or delete. Looks like there is a dequeue but that seems to work similar to the Array pop method.

CapitanRedBeard avatar Jun 12 '19 19:06 CapitanRedBeard

I started this for my own needs https://github.com/sindresorhus/p-queue/issues/140

trajano avatar Apr 11 '21 01:04 trajano

Hmm really more difficult than expected. Task requires a TaskResultType which is derivable from the code somehow. Also task in itself is not exported. I think I'd have to cheat and use any in the end.

trajano avatar Apr 11 '21 05:04 trajano