aboutsummaryrefslogtreecommitdiff
path: root/src/js/arching-kaos-fetch.js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-12-22 04:52:16 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-12-22 04:52:16 +0200
commit694f83921c5c43de47ce1b7298fbadcdd7a7a012 (patch)
tree86b8bbcbaaf5d82d4dfb57db1b2e8c911799c816 /src/js/arching-kaos-fetch.js
parenta84f6765711e92c668ecb3becd2b1ee12b36abe7 (diff)
downloadarching-kaos-web-ui-694f83921c5c43de47ce1b7298fbadcdd7a7a012.tar.gz
arching-kaos-web-ui-694f83921c5c43de47ce1b7298fbadcdd7a7a012.tar.bz2
arching-kaos-web-ui-694f83921c5c43de47ce1b7298fbadcdd7a7a012.zip
AKFS get function from map hash
Diffstat (limited to 'src/js/arching-kaos-fetch.js')
-rw-r--r--src/js/arching-kaos-fetch.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/js/arching-kaos-fetch.js b/src/js/arching-kaos-fetch.js
index 5f27728..6cf1b76 100644
--- a/src/js/arching-kaos-fetch.js
+++ b/src/js/arching-kaos-fetch.js
@@ -65,4 +65,32 @@ export async function archingKaosFetchText( url, callback, params ){
request.open("GET", url);
request.send();
}
+
+export function archingKaosFetchBlob( url, callback, params ){
+ const request = new XMLHttpRequest();
+ request.addEventListener("load", ()=>{
+ var blob = request.response;
+ if(request.status !== 404){
+ callback(blob, params);
+ } else {
+ archingKaosLog(`ERROR ${request.status} while loading ${url}`);
+ }
+ });
+ request.addEventListener("error", ()=>{
+ debugLog("An error occured.");
+ });
+ request.addEventListener("progress", (event)=>{
+ if (event.lengthComputable && progressPlaceholder()){
+ httpProgressPlaceholder().value = (event.loaded / event.total) * 100;
+ } else {
+ httpProgressPlaceholder.value = 0;
+ debugLog("Supposingly zeroed progressPlaceholder");
+ }
+ });
+ request.addEventListener("abort", ()=>{
+ debugLog("Request aborted.");
+ });
+ request.open("GET", url);
+ request.send();
+}
// @license-end