File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,10 @@ import {
2626} from "./funbox/list" ;
2727import * as TestState from "./test-state" ;
2828import * as PaceCaret from "./pace-caret" ;
29- import { requestDebouncedAnimationFrame } from "../utils/debounced-animation-frame" ;
29+ import {
30+ cancelPendingAnimationFramesStartingWith ,
31+ requestDebouncedAnimationFrame ,
32+ } from "../utils/debounced-animation-frame" ;
3033import * as SoundController from "../controllers/sound-controller" ;
3134import * as Numbers from "@monkeytype/util/numbers" ;
3235import * as TestStats from "./test-stats" ;
@@ -165,6 +168,7 @@ export function setResultCalculating(val: boolean): void {
165168
166169export function reset ( ) : void {
167170 currentTestLine = 0 ;
171+ cancelPendingAnimationFramesStartingWith ( "test-ui" ) ;
168172}
169173
170174export function focusWords ( force = false ) : void {
Original file line number Diff line number Diff line change @@ -19,3 +19,15 @@ function cancelIfPending(frameId: string): void {
1919 pendingFrames . delete ( frameId ) ;
2020 }
2121}
22+
23+ export function cancelPendingAnimationFrame ( frameId : string ) : void {
24+ cancelIfPending ( frameId ) ;
25+ }
26+
27+ export function cancelPendingAnimationFramesStartingWith ( prefix : string ) : void {
28+ for ( const frameId of pendingFrames . keys ( ) ) {
29+ if ( frameId . startsWith ( prefix ) ) {
30+ cancelIfPending ( frameId ) ;
31+ }
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments