Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 财产';webkitTemporaryStorage';不存在于类型';导航器&x27;_Typescript_Indexeddb - Fatal编程技术网

Typescript 财产';webkitTemporaryStorage';不存在于类型';导航器&x27;

Typescript 财产';webkitTemporaryStorage';不存在于类型';导航器&x27;,typescript,indexeddb,Typescript,Indexeddb,我正在使用下面的代码检查indexeddb的大小 navigator.webkitTemporaryStorage.queryUsageAndQuota ( function(usedBytes, grantedBytes) { console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes'); }, function(e) { console.log('Error', e); } ); 但是在类型导

我正在使用下面的代码检查indexeddb的大小

navigator.webkitTemporaryStorage.queryUsageAndQuota ( 
function(usedBytes, grantedBytes) {  
    console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes');
}, 
function(e) { console.log('Error', e);  }
);
但是在类型
导航器上不存在类似属性
webkitTemporaryStorage
的错误

我是个新手。谁能帮我解决这个问题


谢谢

首先,这不是角度的问题,而是关于浏览器的问题。看起来它只适用于chrome。这是正确的答案。

更好地了解@kamalav答案(参见他对其他答案的评论):


解决方案是将navigator属性定义为any,问题已经解决了

谢谢。我已经尝试了navigator.storage.estimate()。为此,我得到了“[ts]属性'storage'在类型'navigator'上不存在。any”typescriptIt中的错误由let nav:any=navigator解决;nav.webkitTemporaryStorage.queryUsageAndQuota(函数(usedBytes,grantedBytes){console.log('we-use',usedBytes,'of',grantedBytes,'bytes');},函数(e){console.log('Error',e);});
const nav: any = navigator;
nav.webkitTemporaryStorage.queryUsageAndQuota ( (usedBytes, grantedBytes) => {
    console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes');
}, (e) => {
    console.log('Error', e);
});