aboutsummaryrefslogtreecommitdiff
path: root/src/loadlib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/loadlib.js')
-rw-r--r--src/loadlib.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/loadlib.js b/src/loadlib.js
index dfa082a..7458704 100644
--- a/src/loadlib.js
+++ b/src/loadlib.js
@@ -95,6 +95,17 @@ if (!WEB) {
return true;
};
+} else {
+ /* TODO: use async/await ? */
+ readable = function(filename) {
+ /* TODO: do a GET and store it somewhere to avoid doing two roundtrips ? */
+ let xhr = new XMLHttpRequest();
+ xhr.open("HEAD", filename, false);
+ xhr.send();
+ /* TODO: subresource integrity check? */
+
+ return xhr.status >= 200 && xhr.status <= 299;
+ };
}