|
|
@ -88,11 +88,15 @@ async function fetchRemote(url, cbProgress, cbPrint) {
|
|
|
|
// - check if the data is already in the IndexedDB
|
|
|
|
// - check if the data is already in the IndexedDB
|
|
|
|
// - if not, fetch it from the remote URL and store it in the IndexedDB
|
|
|
|
// - if not, fetch it from the remote URL and store it in the IndexedDB
|
|
|
|
function loadRemote(url, dst, size_mb, cbProgress, cbReady, cbCancel, cbPrint) {
|
|
|
|
function loadRemote(url, dst, size_mb, cbProgress, cbReady, cbCancel, cbPrint) {
|
|
|
|
// query the storage quota and print it
|
|
|
|
if (!navigator.storage || !navigator.storage.estimate) {
|
|
|
|
navigator.storage.estimate().then(function (estimate) {
|
|
|
|
cbPrint('loadRemote: navigator.storage.estimate() is not supported');
|
|
|
|
cbPrint('loadRemote: storage quota: ' + estimate.quota + ' bytes');
|
|
|
|
} else {
|
|
|
|
cbPrint('loadRemote: storage usage: ' + estimate.usage + ' bytes');
|
|
|
|
// query the storage quota and print it
|
|
|
|
});
|
|
|
|
navigator.storage.estimate().then(function (estimate) {
|
|
|
|
|
|
|
|
cbPrint('loadRemote: storage quota: ' + estimate.quota + ' bytes');
|
|
|
|
|
|
|
|
cbPrint('loadRemote: storage usage: ' + estimate.usage + ' bytes');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// check if the data is already in the IndexedDB
|
|
|
|
// check if the data is already in the IndexedDB
|
|
|
|
var rq = indexedDB.open(dbName, dbVersion);
|
|
|
|
var rq = indexedDB.open(dbName, dbVersion);
|
|
|
|