From 8dff73679e909dab8f325cc9458cf5c40c9be485 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:11:10 -0500 Subject: Move apiOptionsSave implementation into Backend --- ext/bg/js/api.js | 7 ++----- 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}) { -- cgit v1.2.3