From ba080f5a4df1437fb6a208c871411c7420df5b4c Mon Sep 17 00:00:00 2001 From: iambumblehead Date: Tue, 16 Jan 2024 06:57:05 -0800 Subject: [PATCH] fix: detect window.requestAnimationFrame function before calling (#1082) Co-authored-by: chris --- src/modules/style.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/style.ts b/src/modules/style.ts index 4ffdb41..46ef52a 100755 --- a/src/modules/style.ts +++ b/src/modules/style.ts @@ -11,9 +11,10 @@ export type VNodeStyle = ElementStyle & // Binding `requestAnimationFrame` like this fixes a bug in IE/Edge. See #360 and #409. const raf = - (typeof window !== "undefined" && - window.requestAnimationFrame.bind(window)) || - setTimeout; + typeof window?.requestAnimationFrame === "function" + ? window.requestAnimationFrame.bind(window) + : setTimeout; + const nextFrame = function (fn: any) { raf(function () { raf(fn);