fix: detect window.requestAnimationFrame function before calling (#1082)

Co-authored-by: chris <chris@bumblehead.com>
pull/1097/head
iambumblehead 1 year ago committed by GitHub
parent 809829de3f
commit ba080f5a4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);

Loading…
Cancel
Save