Closed bobjflong closed 4 years ago
I had to set the typescript version in order to get CI to pass. I'm not sure exactly what that issue is, but it's affecting master too as far as I can tell.
And you need to update: https://github.com/sindresorhus/p-queue#custom-queueclass
Thanks :)
Thanks for a great and useful library.
We use
p-queue
to totally order all of the web requests our app makes. However this means that there is a risk that when the user closes the tab, there is some work left pending in the promise queue.We use priority to discern between important requests (eg. a user action) and unimportant requests (eg. updating something unimportant in the background).
We use an
onbeforeunload
hook to warn the user that they could lose changes ifqueue.size > 0
. However it would be an improvement to user experience if we could only warn them if the queue contains very important actions (based on priority). This is what motivated me to implementsizeBy
, which takes the same priority options asadd
, and filters the results.Interested to hear what you think!