Skip to content

Commit

Permalink
fix: window override was not working
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Sep 25, 2024
1 parent 7ba4030 commit 3a1551e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
21 changes: 20 additions & 1 deletion src/additween/AdditiveTweening.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import { PlainObjectReducer } from "./PlainObjectReducer";
import type { IStateReducer } from "./PlainObjectReducer";

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
};
}
}
function noop() {}

function identity(t: number): number {
Expand Down
20 changes: 0 additions & 20 deletions src/additween/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@ 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 3a1551e

Please sign in to comment.