From 092d44885738ed58215698917ae97c13958f7c7d Mon Sep 17 00:00:00 2001 From: Mohammad Honarvar Date: Fri, 11 Oct 2024 20:04:09 +0330 Subject: [PATCH] fix: use new `global-this` package & remove global type & prevent sidee-ffects --- packages/delay/src/polyfill.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/delay/src/polyfill.ts b/packages/delay/src/polyfill.ts index a33ccc04..6afe3a4f 100644 --- a/packages/delay/src/polyfill.ts +++ b/packages/delay/src/polyfill.ts @@ -1,7 +1,6 @@ -import {globalScope} from '@alwatr/global-this'; +import {getGlobalThis, type GlobalThis} from '@alwatr/global-this'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export const win = globalScope as DictionaryOpt; +export const win = /* #__PURE__ */ getGlobalThis(); // prettier-ignore const requestAnimationFrameFallback = @@ -9,7 +8,7 @@ const requestAnimationFrameFallback = setTimeout(() => callback(Date.now()), 1000 / 60); // prettier-ignore -export const requestAnimationFrame: typeof globalScope.requestAnimationFrame = +export const requestAnimationFrame: GlobalThis['requestAnimationFrame'] = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || @@ -21,7 +20,7 @@ const requestIdleCallbackFallback = setTimeout(callback, options?.timeout ?? 2000); // prettier-ignore -export const requestIdleCallback: typeof globalScope.requestIdleCallback = +export const requestIdleCallback: GlobalThis['requestIdleCallback'] = win.requestIdleCallback || win.webkitRequestIdleCallback || win.mozRequestIdleCallback ||