forked from extern/whisper.cpp
wasm : check if navigator.storage.estimate() is available
Safari does not support it
This commit is contained in:
parent
02c7516c57
commit
60337f5306
File diff suppressed because one or more lines are too long
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user