Skip to content

Commit

Permalink
Do not load polyfill in chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
istarkov committed Jan 29, 2025
1 parent 530725d commit 92ad492
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions @types/scroll-timeline.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ interface ScrollTimelineOptions {

declare class ScrollTimeline extends AnimationTimeline {
constructor(options?: ScrollTimelineOptions);
}

readonly source: Element | Document | null;
readonly axis: ScrollAxis;
declare class ViewTimeline extends ScrollTimeline {
constructor(options?: ScrollTimelineOptions);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { use } from "react";

let clientPolyfillCache: null | Promise<void> = null;

const fullfilledPromise = Promise.resolve();

const polyfill = () => {
if (typeof ViewTimeline !== "undefined") {
return fullfilledPromise;
}

if (clientPolyfillCache === null) {
clientPolyfillCache = import(
// @ts-expect-error no types exists
Expand Down

0 comments on commit 92ad492

Please sign in to comment.