From 6684f3fce6e90fd0574d7bab63b629554ab03ef6 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 20 Nov 2024 13:31:50 +0000 Subject: Prettified Code! --- webAO/utils/fileExists.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'webAO/utils/fileExists.ts') diff --git a/webAO/utils/fileExists.ts b/webAO/utils/fileExists.ts index abb2928..1dceb72 100644 --- a/webAO/utils/fileExists.ts +++ b/webAO/utils/fileExists.ts @@ -1,19 +1,19 @@ export default async function fileExists(url: string): Promise { - return new Promise((resolve) => { - const xhr = new XMLHttpRequest(); - xhr.open('HEAD', url); - xhr.onload = function checkLoad() { - if (xhr.readyState === 4) { - if (xhr.status === 200) { - resolve(true); - } else { - resolve(false); - } - } - }; - xhr.onerror = function checkError() { - resolve(false); - }; - xhr.send(null); - }); + return new Promise((resolve) => { + const xhr = new XMLHttpRequest(); + xhr.open("HEAD", url); + xhr.onload = function checkLoad() { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + resolve(true); + } else { + resolve(false); + } + } + }; + xhr.onerror = function checkError() { + resolve(false); + }; + xhr.send(null); + }); } -- cgit