Merged in feature/81-dev-dev01 (pull request #5)

auto-patch  81-dev-dev01-2023-12-05T22_45_26

* auto-patch  81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
Tony Volpe
2023-12-05 23:05:59 +00:00
parent ba16964e7a
commit 725d3043d5
1463 changed files with 142461 additions and 89421 deletions

View File

@@ -36,16 +36,17 @@
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "createBlobURL": function() { return /* binding */ createBlobURL; },
/* harmony export */ "getBlobByURL": function() { return /* binding */ getBlobByURL; },
/* harmony export */ "getBlobTypeByURL": function() { return /* binding */ getBlobTypeByURL; },
/* harmony export */ "isBlobURL": function() { return /* binding */ isBlobURL; },
/* harmony export */ "revokeBlobURL": function() { return /* binding */ revokeBlobURL; }
/* harmony export */ createBlobURL: function() { return /* binding */ createBlobURL; },
/* harmony export */ getBlobByURL: function() { return /* binding */ getBlobByURL; },
/* harmony export */ getBlobTypeByURL: function() { return /* binding */ getBlobTypeByURL; },
/* harmony export */ isBlobURL: function() { return /* binding */ isBlobURL; },
/* harmony export */ revokeBlobURL: function() { return /* binding */ revokeBlobURL; }
/* harmony export */ });
/**
* @type {Record<string, File|undefined>}
*/
const cache = {};
/**
* Create a blob URL from a file.
*
@@ -53,12 +54,12 @@ const cache = {};
*
* @return {string} The blob URL.
*/
function createBlobURL(file) {
const url = window.URL.createObjectURL(file);
cache[url] = file;
return url;
}
/**
* Retrieve a file based on a blob URL. The file must have been created by
* `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return
@@ -68,10 +69,10 @@ function createBlobURL(file) {
*
* @return {File|undefined} The file for the blob URL.
*/
function getBlobByURL(url) {
return cache[url];
}
/**
* Retrieve a blob type based on URL. The file must have been created by
* `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return
@@ -81,36 +82,33 @@ function getBlobByURL(url) {
*
* @return {string|undefined} The blob type.
*/
function getBlobTypeByURL(url) {
return getBlobByURL(url)?.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).
}
/**
* Remove the resource and file cache from memory.
*
* @param {string} url The blob URL.
*/
function revokeBlobURL(url) {
if (cache[url]) {
window.URL.revokeObjectURL(url);
}
delete cache[url];
}
/**
* Check whether a url is a blob url.
*
* @param {string} url The URL.
* @param {string|undefined} url The URL.
*
* @return {boolean} Is the url a blob url?
*/
function isBlobURL(url) {
if (!url || !url.indexOf) {
return false;
}
return url.indexOf('blob:') === 0;
}