aboutsummaryrefslogtreecommitdiff
path: root/webAO/utils/fileExists.js
diff options
context:
space:
mode:
Diffstat (limited to 'webAO/utils/fileExists.js')
-rw-r--r--webAO/utils/fileExists.js37
1 files changed, 16 insertions, 21 deletions
diff --git a/webAO/utils/fileExists.js b/webAO/utils/fileExists.js
index 3065112..13958e0 100644
--- a/webAO/utils/fileExists.js
+++ b/webAO/utils/fileExists.js
@@ -1,23 +1,18 @@
-
-const fileExists = async (url) => {
- return new Promise((resolve, reject) => {
- const xhr = new XMLHttpRequest();
- xhr.open('HEAD', url);
- xhr.onload = function (e) {
- if (xhr.readyState === 4) {
- if (xhr.status === 200) {
- resolve(true)
- } else {
- reject(false)
- }
+const fileExists = async (url) => new Promise((resolve, reject) => {
+ const xhr = new XMLHttpRequest();
+ xhr.open('HEAD', url);
+ xhr.onload = function (e) {
+ if (xhr.readyState === 4) {
+ if (xhr.status === 200) {
+ resolve(true);
+ } else {
+ reject(false);
}
- };
- xhr.onerror = function (e) {
- resolve(false)
- };
- xhr.send(null);
- })
-
-
-};
+ }
+ };
+ xhr.onerror = function (e) {
+ resolve(false);
+ };
+ xhr.send(null);
+});
export default fileExists;