Remove config after unlink, clear db when linked with new number
This commit is contained in:
parent
fd056e1b4c
commit
9acb189650
7 changed files with 108 additions and 11 deletions
17
js/backup.js
17
js/backup.js
|
@ -913,9 +913,13 @@
|
|||
}
|
||||
|
||||
function clearAllStores(idb_db) {
|
||||
return clearStores(idb_db);
|
||||
}
|
||||
|
||||
function clearStores(idb_db, names) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
console.log('Clearing all indexeddb stores');
|
||||
var storeNames = idb_db.objectStoreNames;
|
||||
var storeNames = names || idb_db.objectStoreNames;
|
||||
console.log('Clearing these indexeddb stores:', storeNames);
|
||||
var transaction = idb_db.transaction(storeNames, 'readwrite');
|
||||
|
||||
var finished = false;
|
||||
|
@ -930,7 +934,7 @@
|
|||
transaction.oncomplete = finish.bind(null, 'transaction complete');
|
||||
transaction.onerror = function(e) {
|
||||
handleDOMException(
|
||||
'clearAllStores transaction error',
|
||||
'clearStores transaction error',
|
||||
transaction.error,
|
||||
reject
|
||||
);
|
||||
|
@ -953,7 +957,7 @@
|
|||
|
||||
request.onerror = function(e) {
|
||||
handleDOMException(
|
||||
'clearAllStores request error',
|
||||
'clearStores request error',
|
||||
request.error,
|
||||
reject
|
||||
);
|
||||
|
@ -973,6 +977,11 @@
|
|||
return clearAllStores(idb_db);
|
||||
});
|
||||
},
|
||||
clearStores: function(storeNames) {
|
||||
return openDatabase().then(function(idb_db) {
|
||||
return clearStores(idb_db, storeNames);
|
||||
});
|
||||
},
|
||||
getDirectoryForExport: function() {
|
||||
var options = {
|
||||
title: i18n('exportChooserTitle'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue