Skip to content

Commit

Permalink
resolve #4 push splice operation to event loop immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardwu1 committed Nov 16, 2018
1 parent 0321150 commit d2cb7e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/replay/timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default class Timer {
*/
public addAction(action: actionWithDelay) {
const index = this.findActionIndex(action);
this.actions.splice(index, 0, action);
setTimeout(() => {
this.actions.splice(index, 0, action);
}, 0);
}
/**
* Add all actions before the timer starts
Expand Down

0 comments on commit d2cb7e3

Please sign in to comment.