From 392b6500373b5e727e524ce0c2400b52fe165602 Mon Sep 17 00:00:00 2001 From: Dan Cherouny Date: Sun, 27 Oct 2024 10:22:51 +0100 Subject: [PATCH 1/3] Update index.ts Add check for typeof window, fallback to throttle if undefined --- packages/scheduled/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/scheduled/src/index.ts b/packages/scheduled/src/index.ts index 65e676437..3de2a6c65 100644 --- a/packages/scheduled/src/index.ts +++ b/packages/scheduled/src/index.ts @@ -112,7 +112,7 @@ export const throttle: ScheduleCallback = (callback, wait) => { export const scheduleIdle: ScheduleCallback = isServer ? () => Object.assign(() => void 0, { clear: () => void 0 }) : // requestIdleCallback is not supported in Safari - (window.requestIdleCallback as typeof window.requestIdleCallback | undefined) + (typeof window !== 'undefined' && window.requestIdleCallback as typeof window.requestIdleCallback | undefined) ? (callback, maxWait) => { let isDeferred = false, id: ReturnType, From 57a30783042886cb91f285c66669916bf254edeb Mon Sep 17 00:00:00 2001 From: Damian Tarnawski Date: Sun, 27 Oct 2024 11:49:38 +0100 Subject: [PATCH 2/3] Create fresh-points-join.md --- .changeset/fresh-points-join.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fresh-points-join.md diff --git a/.changeset/fresh-points-join.md b/.changeset/fresh-points-join.md new file mode 100644 index 000000000..6574d8936 --- /dev/null +++ b/.changeset/fresh-points-join.md @@ -0,0 +1,5 @@ +--- +"@solid-primitives/scheduled": patch +--- + +Add check for typeof window, fallback to throttle if undefined From 5f9c6cd70ba978d1f3c4227f9380f67ad7910a38 Mon Sep 17 00:00:00 2001 From: Dan Cherouny Date: Sun, 27 Oct 2024 13:09:47 +0100 Subject: [PATCH 3/3] Update packages/scheduled/src/index.ts Yep :) Co-authored-by: Damian Tarnawski --- packages/scheduled/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/scheduled/src/index.ts b/packages/scheduled/src/index.ts index 3de2a6c65..ee4fd2dae 100644 --- a/packages/scheduled/src/index.ts +++ b/packages/scheduled/src/index.ts @@ -112,7 +112,7 @@ export const throttle: ScheduleCallback = (callback, wait) => { export const scheduleIdle: ScheduleCallback = isServer ? () => Object.assign(() => void 0, { clear: () => void 0 }) : // requestIdleCallback is not supported in Safari - (typeof window !== 'undefined' && window.requestIdleCallback as typeof window.requestIdleCallback | undefined) + (typeof requestIdleCallback !== 'undefined') ? (callback, maxWait) => { let isDeferred = false, id: ReturnType,