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

Count of active timers #163

Closed
radarfox opened this issue May 5, 2018 · 2 comments
Closed

Count of active timers #163

radarfox opened this issue May 5, 2018 · 2 comments

Comments

@radarfox
Copy link

radarfox commented May 5, 2018

Hello,

I would like to find out how many timers is actively running, but I can't find any mention of it in the API reference.

My use case is that I'm writing a test for a destructor function and I would like to make sure that all timers got cancelled after the function execution so there would be no memory leaks.

Currently I'm using this hotfix Object.keys(clock.timers || {}).length, but it seems quite verbose and dependent on the inner implementation.

@benjamingr
Copy link
Member

.uninstall returns all the pending timers as an array. You can check its .length which is less hacky although I'm not sure we have this behavior documented.

Docs PR for the use case is welcome

@benjamingr
Copy link
Member

Going to close this since I haven't received feedback in 7 days. Feel free to comment at any point.

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

No branches or pull requests

2 participants