Add setRenewingTimeout

pull/162/head
Varun Patil 2022-10-29 17:20:09 -07:00
parent 32bc48418f
commit 256a57b12e
1 changed files with 14 additions and 0 deletions

View File

@ -198,6 +198,20 @@ export function getFolderRoutePath(basePath: string) {
return path;
}
/** Set a timer that renews if existing */
export function setRenewingTimeout(
ctx: any,
name: string,
callback: () => void | null,
delay: number
) {
if (ctx[name]) window.clearTimeout(ctx[name]);
ctx[name] = window.setTimeout(() => {
ctx[name] = 0;
callback?.();
}, delay);
}
// Outside for set
const TagDayID = {
START: -(1 << 30),