aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/yomichan.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r--ext/bg/js/yomichan.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index acc560ce..eb083396 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -195,6 +195,14 @@ window.yomichan = new class {
}
onMessage({action, params}, sender, callback) {
+ const promiseCallback = (promise, callback) => {
+ return promise.then(result => {
+ callback({result});
+ }).catch(error => {
+ callback({error});
+ });
+ };
+
const handlers = {
optionsGet: ({callback}) => {
promiseCallback(optionsLoad(), callback);