diff options
Diffstat (limited to 'ext/bg/js/backend.js')
| -rw-r--r-- | ext/bg/js/backend.js | 11 | 
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 453f4282..f29230a2 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -73,9 +73,10 @@ class Backend {          if (handlers.hasOwnProperty(action)) {              const handler = handlers[action];              const promise = handler(params, sender); -            promise -                .then(result => callback({result})) -                .catch(error => callback(errorToJson(error))); +            promise.then( +                result => callback({result}), +                error => callback({error: errorToJson(error)}) +            );          }          return true; @@ -180,11 +181,13 @@ Backend.messageHandlers = {      definitionsAddable: ({definitions, modes, optionsContext}) => apiDefinitionsAddable(definitions, modes, optionsContext),      noteView: ({noteId}) => apiNoteView(noteId),      templateRender: ({template, data, dynamic}) => apiTemplateRender(template, data, dynamic), -    commandExec: ({command}) => apiCommandExec(command), +    commandExec: ({command, params}) => apiCommandExec(command, params),      audioGetUrl: ({definition, source, optionsContext}) => apiAudioGetUrl(definition, source, optionsContext),      screenshotGet: ({options}, sender) => apiScreenshotGet(options, sender),      forward: ({action, params}, sender) => apiForward(action, params, sender),      frameInformationGet: (params, sender) => apiFrameInformationGet(sender), +    injectStylesheet: ({css}, sender) => apiInjectStylesheet(css, sender), +    getEnvironmentInfo: () => apiGetEnvironmentInfo()  };  window.yomichan_backend = new Backend();  |