diff --git a/src/util/util/extensions/Global.ts b/src/util/util/extensions/Global.ts index a6886f66..0dc39b42 100644 --- a/src/util/util/extensions/Global.ts +++ b/src/util/util/extensions/Global.ts @@ -2,9 +2,13 @@ declare global { function sleep(ms: number): Promise; } +export function globalSleep(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + if (!globalThis.sleep) { globalThis.sleep = function (ms: number): Promise { - return new Promise((resolve) => setTimeout(resolve, ms)); + return globalSleep(ms); }; } diff --git a/src/util/util/extensions/Math.ts b/src/util/util/extensions/Math.ts index 76587bc5..a5bd80c3 100644 --- a/src/util/util/extensions/Math.ts +++ b/src/util/util/extensions/Math.ts @@ -22,11 +22,10 @@ declare global { } } -export function clamp(value: number, min: number, max: number): number { +export function mathClamp(value: number, min: number, max: number): number { return Math.min(Math.max(value, min), max); } // register extensions -if (!Math.clamp) { - Math.clamp = clamp; -} \ No newline at end of file +if (!Math.clamp) + Math.clamp = mathClamp; \ No newline at end of file