diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-09 21:11:10 -0500 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-13 23:11:56 -0500 | 
| commit | 8dff73679e909dab8f325cc9458cf5c40c9be485 (patch) | |
| tree | 29c72223c13304d67467bb5e1e296f6209efe6a8 | |
| parent | 6a1cfbaad62bc60e8415821039e028432d64b549 (diff) | |
Move apiOptionsSave implementation into Backend
| -rw-r--r-- | ext/bg/js/api.js | 7 | ||||
| -rw-r--r-- | ext/bg/js/backend.js | 6 | 
2 files changed, 6 insertions, 7 deletions
| diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 4c55c6e3..3e821333 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -29,11 +29,8 @@ function apiOptionsGetFull() {      return utilBackend()._onApiOptionsGetFull();  } -async function apiOptionsSave(source) { -    const backend = utilBackend(); -    const options = await apiOptionsGetFull(); -    await optionsSave(options); -    backend.onOptionsUpdated(source); +function apiOptionsSave(source) { +    return utilBackend()._onApiOptionsSave({source});  }  async function apiTermsFind(text, details, optionsContext) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 74cd2ab4..5753e16e 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -234,8 +234,10 @@ class Backend {          await this._optionsSave({source});      } -    _onApiOptionsSave({source}) { -        return apiOptionsSave(source); +    async _onApiOptionsSave({source}) { +        const options = await this.getFullOptions(); +        await optionsSave(options); +        this.onOptionsUpdated(source);      }      _onApiKanjiFind({text, optionsContext}) { |