Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for clearing the queue #20

Merged
merged 6 commits into from
Apr 5, 2020
Merged

Add support for clearing the queue #20

merged 6 commits into from
Apr 5, 2020

Conversation

callmehiphop
Copy link
Contributor

Closes #18

Issue had been sitting for a little bit, so I decided to try my hand at it. Sorry in advance for any glaring mistakes!

readme.md Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Bump :)

@shirshak55
Copy link

hmm do clearing queue means settings current queue length to 0 sufficient only?

@callmehiphop
Copy link
Contributor Author

@shirshak55 it's a personal preference for emptying arrays, allows us to re-use the same array without increasing the time complexity (I think).

@shirshak55
Copy link

shirshak55 commented Feb 27, 2020

@callmehiphop yea I think it is correct and best option here. Was just worried like lets say there are 2 promise and are running and we reset the queue but those promises would still be running and user may think pending count is 0 meaning javascript is doing nothing (But in reality its still running those promises.) . Yea I don't think there is easy way to cancel running promise :(

@callmehiphop
Copy link
Contributor Author

@shirshak55 oh! That isn't really what the scope of this PR covers. This only clears the queue of functions waiting to be called, once they're executed there is no stopping them. You might be able to do something clever using a cancelable promise though.

@sindresorhus
Copy link
Owner

The TS file should be in sync with the readme documentation-wise.

@callmehiphop
Copy link
Contributor Author

@sindresorhus ah right, sorry about that! I think we should be good to go now 🤞

@sindresorhus sindresorhus changed the title Add support for clearing queue Add support for clearing the queue Apr 5, 2020
@sindresorhus sindresorhus merged commit d91b326 into sindresorhus:master Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Ability to clear the queue
3 participants