diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-07-19 21:28:09 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-07-19 21:28:09 -0700 |
commit | fe137e94c92cf0366735936b6ac82dc147b1ad33 (patch) | |
tree | 76382040a15ef4fb32d6a8dfb5a7ecc023ab2fde /ext/bg/js/yomichan.js | |
parent | 62db3d74b8042dd3185a7a552920a2ce7a4bd4ab (diff) |
cleanup
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r-- | ext/bg/js/yomichan.js | 8 |
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); |