aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/api.js')
-rw-r--r--ext/fg/js/api.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/fg/js/api.js b/ext/fg/js/api.js
index 7316c604..643d0360 100644
--- a/ext/fg/js/api.js
+++ b/ext/fg/js/api.js
@@ -17,26 +17,26 @@
*/
-function bgSendMessage(action, params, callback) {
- chrome.runtime.sendMessage({action, params}, callback);
+function bgSendMessage(action, params) {
+ return new Promise((resolve, reject) => chrome.runtime.sendMessage({action, params}, resolve));
}
-function bgFindTerm(text, callback) {
- bgSendMessage('findTerm', {text}, callback);
+function bgFindTerm(text) {
+ return bgSendMessage('findTerm', {text});
}
-function bgFindKanji(text, callback) {
- bgSendMessage('findKanji', {text}, callback);
+function bgFindKanji(text) {
+ return bgSendMessage('findKanji', {text});
}
-function bgRenderText(data, template, callback) {
- bgSendMessage('renderText', {data, template}, callback);
+function bgRenderText(data, template) {
+ return bgSendMessage('renderText', {data, template});
}
-function bgCanAddDefinitions(definitions, modes, callback) {
- bgSendMessage('canAddDefinitions', {definitions, modes}, callback);
+function bgCanAddDefinitions(definitions, modes) {
+ return bgSendMessage('canAddDefinitions', {definitions, modes});
}
-function bgAddDefinition(definition, mode, callback) {
- bgSendMessage('addDefinition', {definition, mode}, callback);
+function bgAddDefinition(definition, mode) {
+ return bgSendMessage('addDefinition', {definition, mode});
}