diff --git a/src/factories/history-state-factory.ts b/src/factories/history-state-factory.ts index e434f13..d04aec9 100644 --- a/src/factories/history-state-factory.ts +++ b/src/factories/history-state-factory.ts @@ -48,7 +48,7 @@ export const hasQueue = (): boolean => queueLength() > 0; export const queueLength = (): number => stateQueue.size; export const flushQueue = (): void => { - clearTimeout( timeout ); + window.clearTimeout( timeout ); stateQueue.clear(); }; @@ -80,13 +80,13 @@ export const enqueueState = ( key: string, undoRedoState: UndoRedoState ): void processQueue(); } stateQueue.set( key, undoRedoState ); - setTimeout( processQueue, ENQUEUE_TIMEOUT ); + window.setTimeout( processQueue, ENQUEUE_TIMEOUT ); }; /* internal methods */ function processQueue(): void { - clearTimeout( timeout ); + window.clearTimeout( timeout ); stateQueue.forEach( undoRedoState => store.commit( "saveState", undoRedoState )); stateQueue.clear(); } diff --git a/src/rendering/canvas-elements/layer-sprite.ts b/src/rendering/canvas-elements/layer-sprite.ts index 6520bf7..6458a34 100644 --- a/src/rendering/canvas-elements/layer-sprite.ts +++ b/src/rendering/canvas-elements/layer-sprite.ts @@ -425,14 +425,14 @@ class LayerSprite extends ZoomableSprite { } debouncePaintStore( timeout: number = 5000 ): void { - this._pendingPaintState = setTimeout( this.storePaintState.bind( this ), timeout ) as unknown as number; + this._pendingPaintState = window.setTimeout( this.storePaintState.bind( this ), timeout ) as unknown as number; } async storePaintState(): Promise { if ( !this._pendingPaintState ) { return true; } - clearTimeout( this._pendingPaintState ); + window.clearTimeout( this._pendingPaintState ); if ( this._brush.down ) { // still painting, debounce again (layer.source only updated on handleRelease()) this.debouncePaintStore( 1000 );