From 5295a0b563d01bdfe00ee5e0380e23e019107e9c Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 3 Oct 2025 20:52:03 +0200 Subject: [PATCH] Clean up other extensions --- src/util/util/extensions/Global.ts | 6 +++++- src/util/util/extensions/Math.ts | 7 +++---- 2 files changed, 8 insertions(+), 5 deletions(-) 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