mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-08 10:07:04 +02:00
Update utils.ts
This commit is contained in:
@@ -135,7 +135,7 @@ export const throttleRAF = <T extends any[]>(
|
|||||||
let timerId: number | null = null;
|
let timerId: number | null = null;
|
||||||
let lastArgs: T | null = null;
|
let lastArgs: T | null = null;
|
||||||
let lastArgsTrailing: T | null = null;
|
let lastArgsTrailing: T | null = null;
|
||||||
let watchdog: NodeJS.Timeout | null = null;
|
let watchdog: number | null = null;
|
||||||
|
|
||||||
const scheduleFunc = (args: T) => {
|
const scheduleFunc = (args: T) => {
|
||||||
timerId = window.requestAnimationFrame(() => {
|
timerId = window.requestAnimationFrame(() => {
|
||||||
@@ -189,13 +189,13 @@ export const throttleRAF = <T extends any[]>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
watchdog = setTimeout(() => {
|
watchdog = window.setTimeout(() => {
|
||||||
console.log("watchdog", timerId);
|
console.log("watchdog", timerId);
|
||||||
if (timerId !== null) {
|
if (timerId !== null) {
|
||||||
cancelAnimationFrame(timerId);
|
cancelAnimationFrame(timerId);
|
||||||
timerId = null;
|
timerId = null;
|
||||||
}
|
}
|
||||||
},1000);
|
}, 1000);
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user