Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function clear(name?: string) {
const keys = await IDBKeyVal.keys();
for (const key of keys) {
if (!name || key === name) {
console.log(`Deleting ${key}`);
await IDBKeyVal.del(key);
}
}
}
PersistentCache.prototype.delete = function (key) {
var _this = this;
assert_1.assert(isAllowedAsKey(key), 'PersistentCache -> The given type of key is not allowed');
idb_keyval_1.del(key, this.store).catch(function (err) {
console.warn("PersistentCache -> Delete: { key: " + key + " } has failed with error: " + err);
_this.memoryCache.delete(key);
});
};
/**
private deleteManifestFile() {
localStorage.removeItem(this.localStorageKey);
del(this.idbKey);
}
async remove(key) {
if (TdLibController.localStorage) {
localStorage.removeItem(key);
} else {
await del(key);
}
}
ks.forEach((key) => {
del(key, localStorage);
});
private deleteManifestFile() {
localStorage.removeItem(this.localStorageKey);
del(this.idbKey);
}
public async removeItem(key: string): Promise {
try {
await del(key, this.store);
return true;
} catch (error) {
return false;
}
}
keys.map((key) => {
return idbKeyval.del(key);
})
).then(() => {