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

Support timeout.refresh in node environments #328

Merged
merged 1 commit into from
Jun 6, 2020

Conversation

rgroothuijsen
Copy link
Contributor

Purpose

Fix issue #187 by adding an actual implementation to refresh().

Background

Previously, refresh() was added to the timer API as an alternative to manually resetting timeouts via clearTimeout() and setTimeout(). However, while the interface itself was added, it remained a no-op function. This is confusing, since the presence of this function creates the expectation that the timer has been refreshed when it actually hasn't.

Solution

refresh() now clears the existing timeout and generates a new one with the same function and delay parameters, but a new ID.

@codecov
Copy link

codecov bot commented May 28, 2020

Codecov Report

Merging #328 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #328      +/-   ##
==========================================
+ Coverage   93.11%   93.12%   +0.01%     
==========================================
  Files           1        1              
  Lines         552      553       +1     
==========================================
+ Hits          514      515       +1     
  Misses         38       38              
Flag Coverage Δ
#unit 93.12% <100.00%> (+0.01%) ⬆️
Impacted Files Coverage Δ
src/fake-timers-src.js 93.12% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89e9e9b...2bcf132. Read the comment docs.

Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks correct.

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.

2 participants