summaryrefslogtreecommitdiff
path: root/ext/bg/js/yomichan.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-07-19 21:28:09 -0700
committerAlex Yatskov <alex@foosoft.net>2017-07-19 21:28:09 -0700
commitfe137e94c92cf0366735936b6ac82dc147b1ad33 (patch)
tree76382040a15ef4fb32d6a8dfb5a7ecc023ab2fde /ext/bg/js/yomichan.js
parent62db3d74b8042dd3185a7a552920a2ce7a4bd4ab (diff)
cleanup
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);