Skip to content

Commit 393f1ce

Browse files
authored
Set fake timers after calling throttle
Calling throttle before setting the fake timers will break any implementations that save a timestamp outside the wrapper function.
1 parent 0ef2dd3 commit 393f1ce

File tree

1 file changed

+1
-1
lines changed
  • 1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/_js.view

1 file changed

+1
-1
lines changed

1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/_js.view/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ describe("throttle(f, 1000)", function() {
77
}
88

99
before(function() {
10-
f1000 = throttle(f, 1000);
1110
this.clock = sinon.useFakeTimers();
11+
f1000 = throttle(f, 1000);
1212
});
1313

1414
it("the first call runs now", function() {

0 commit comments

Comments
 (0)