diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-12-22 04:45:45 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-12-22 04:45:45 +0200 |
commit | f0be1d4485228edbe096dde4fa82a5d5ab1f5176 (patch) | |
tree | 09b166f04c41df26d3ffbf3970773a64251fdec4 /src/js/utils.js | |
parent | 8dd45fe02ef44fae11bee385d6d226c471b99d26 (diff) | |
download | arching-kaos-web-ui-f0be1d4485228edbe096dde4fa82a5d5ab1f5176.tar.gz arching-kaos-web-ui-f0be1d4485228edbe096dde4fa82a5d5ab1f5176.tar.bz2 arching-kaos-web-ui-f0be1d4485228edbe096dde4fa82a5d5ab1f5176.zip |
New utility function to offer data for downloading
Diffstat (limited to 'src/js/utils.js')
-rw-r--r-- | src/js/utils.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/js/utils.js b/src/js/utils.js index 74f3cfa..a952328 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -26,4 +26,13 @@ export function debugLog(message) { if (showDebug) console.log(message); } + +export function offerDownloadableData(data) +{ + var link = document.createElement('a'); + link.download = 'data'; + var blob = new Blob([data]); // , {type: 'text/plain'} + link.href = window.URL.createObjectURL(blob); + link.click(); +} // @license-end |