aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-06 19:28:26 -0400
committerGitHub <noreply@github.com>2020-05-06 19:28:26 -0400
commit021ccb5ac3038f63d07ccc9575ee56480031a251 (patch)
tree2d83181aed20494c5c73943dc878f06bb89bb211 /ext/mixed/js
parent501281e887fb66b490f90e7593639112b058ab97 (diff)
Move util database modification functions (#499)
* Update onProgress callback to handle multiple arguments * Add apiImportDictionaryArchive * Add apiDeleteDictionary * Make onProgress the last argument for consistency * Remove deprecated util functions * Fix issue with missing progress args * Remove function calls which modify the database from Translator * Update tests * Fix errors not being serialized correctly in _createActionListenerPort
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/api.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js
index ca4bdd6c..af97ac3d 100644
--- a/ext/mixed/js/api.js
+++ b/ext/mixed/js/api.js
@@ -152,6 +152,14 @@ function apiLogIndicatorClear() {
return _apiInvoke('logIndicatorClear');
}
+function apiImportDictionaryArchive(archiveContent, details, onProgress) {
+ return _apiInvokeWithProgress('importDictionaryArchive', {archiveContent, details}, onProgress);
+}
+
+function apiDeleteDictionary(dictionaryName, onProgress) {
+ return _apiInvokeWithProgress('deleteDictionary', {dictionaryName}, onProgress);
+}
+
function _apiCreateActionPort(timeout=5000) {
return new Promise((resolve, reject) => {
let timer = null;
@@ -213,7 +221,7 @@ function _apiInvokeWithProgress(action, params, onProgress, timeout=5000) {
break;
case 'progress':
try {
- onProgress(message.data);
+ onProgress(...message.data);
} catch (e) {
// NOP
}