Adding clearData to CompactIDB
compactIDB.clearData clears all data in the given objectstore.
This commit is contained in:
parent
38f43d805d
commit
0308af983f
@ -8470,6 +8470,18 @@ Bitcoin.Util = {
|
||||
});
|
||||
},
|
||||
|
||||
clearData: function (obsName, dbName = this.dbName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.openDB(dbName).then(db => {
|
||||
var obs = db.transaction(obsName, "readwrite").objectStore(obsName);
|
||||
let clearReq = obs.clear();
|
||||
clearReq.onsuccess = (evt) => resolve(`Clear data Successful`);
|
||||
clearReq.onerror = (evt) => reject(`Clear data Unsuccessful`);
|
||||
db.close();
|
||||
}).catch(error => reject(error));
|
||||
});
|
||||
},
|
||||
|
||||
readData: function (obsName, key, dbName = this.dbName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.openDB(dbName).then(db => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user