Property 'webkitTemporaryStorage' does not exist on type 'Navigator'

Viewed 622

I am using below code to check size of indexeddb

navigator.webkitTemporaryStorage.queryUsageAndQuota ( 
function(usedBytes, grantedBytes) {  
    console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes');
}, 
function(e) { console.log('Error', e);  }
);

But got error like Property webkitTemporaryStorage does not exist on type Navigator.

I am new to angular. can anyone pls help me solve this.

Thanks

2 Answers

First of all, this isn't issue of Angular, it's about browser. Well it's looks like it will only work for chrome. Here is right answer for that.

Better view of @kamalav answer (see his comment on other answer) :

const nav: any = navigator;
nav.webkitTemporaryStorage.queryUsageAndQuota ( (usedBytes, grantedBytes) => {
    console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes');
}, (e) => {
    console.log('Error', e);
});

The solution is to define navigator property as any and problem is fixed

Related