Skip to content

Commit

Permalink
fix: ensure global.window is set up correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Sep 25, 2024
1 parent 2c35a60 commit 39f35ad
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/additween/getCurrentTime.ts

This file was deleted.

20 changes: 20 additions & 0 deletions src/additween/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@ import type { IStateReducer } from "./PlainObjectReducer";
import type { EasingFunction } from "./AdditiveTweening";
import { PlainObjectReducer } from "./PlainObjectReducer";
import { AdditiveTweening } from "./AdditiveTweening";
import { time } from '@nativescript/core/profiling';

if (!global.window) {
global.window = {
requestAnimationFrame,
cancelAnimationFrame,
performance: {
now: time
}
} as any;
} else if (!global.window.requestAnimationFrame) {
global.window.requestAnimationFrame = requestAnimationFrame;
global.window.cancelAnimationFrame = cancelAnimationFrame;
if (!global.window.performance) {
//@ts-ignore
global.window.performance = {
now: time
};
}
}

export type { EasingFunction, IStateReducer };

Expand Down

0 comments on commit 39f35ad

Please sign in to comment.