diff options
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r-- | ext/bg/js/util.js | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 1ca0833b..3dd5fd55 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -16,12 +16,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -function utilAsync(func) { - return function(...args) { - func.apply(this, args); - }; -} - function utilIsolate(data) { return JSON.parse(JSON.stringify(data)); } @@ -47,13 +41,13 @@ function utilSetEqual(setA, setB) { function utilSetIntersection(setA, setB) { return new Set( - [...setA].filter(value => setB.has(value)) + [...setA].filter((value) => setB.has(value)) ); } function utilSetDifference(setA, setB) { return new Set( - [...setA].filter(value => !setB.has(value)) + [...setA].filter((value) => !setB.has(value)) ); } @@ -80,8 +74,12 @@ function utilAnkiGetDeckNames() { return utilBackend().anki.getDeckNames(); } -function utilDatabaseSummarize() { - return utilBackend().translator.database.summarize(); +function utilDatabaseGetDictionaryInfo() { + return utilBackend().translator.database.getDictionaryInfo(); +} + +function utilDatabaseGetDictionaryCounts(dictionaryNames, getTotal) { + return utilBackend().translator.database.getDictionaryCounts(dictionaryNames, getTotal); } function utilAnkiGetModelFieldNames(modelName) { @@ -92,6 +90,10 @@ function utilDatabasePurge() { return utilBackend().translator.purgeDatabase(); } +function utilDatabaseDeleteDictionary(dictionaryName, onProgress) { + return utilBackend().translator.database.deleteDictionary(dictionaryName, onProgress); +} + async function utilDatabaseImport(data, progress, exceptions) { // Edge cannot read data on the background page due to the File object // being created from a different window. Read on the same page instead. @@ -109,7 +111,3 @@ function utilReadFile(file) { reader.readAsBinaryString(file); }); } - -function utilIsObject(value) { - return typeof value === 'object' && value !== null && !Array.isArray(value); -} |