aboutsummaryrefslogtreecommitdiff
path: root/webAO/utils/fileExists.ts
diff options
context:
space:
mode:
Diffstat (limited to 'webAO/utils/fileExists.ts')
-rw-r--r--webAO/utils/fileExists.ts34
1 files changed, 17 insertions, 17 deletions
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<boolean> {
- 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);
+ });
}