Skip to content

Commit 454a9c3

Browse files
committed
3.3
1 parent 42f8fba commit 454a9c3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

03-callbacks-and-events/ticker.fix.mjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ function ticker(
1212
let tick_count = 0;
1313

1414
let ticker50 = () => {
15-
setTimeout(() => {
16-
if (ticker50 !== null) {
15+
if (ticker50 !== null) {
16+
process.nextTick(() => {
1717
emitter.emit('tick');
1818
tick_count++;
19-
ticker50();
20-
}
21-
}, 50);
19+
});
20+
setTimeout(ticker50, 50);
21+
}
2222
};
2323

2424
setTimeout(() => {

0 commit comments

Comments
 (0)