diff options
author | Alex Yatskov <alex@foosoft.net> | 2019-12-03 18:30:22 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2019-12-03 18:30:22 -0800 |
commit | f9ea6206550ceee625ea93215a6e08d45a750086 (patch) | |
tree | 803fe11a788a631076b3fb11a98e50bb8b454396 /ext/bg/js/util.js | |
parent | 08ad2779678cd447bd747c2b155ef9b5135fdf5d (diff) | |
parent | 3975aabf4dc283d49ec46d0ed7ead982b9fa7441 (diff) |
Merge branch 'master' into testing
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); -} |