diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-09-15 19:48:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-15 19:48:58 -0400 |
commit | 79ef6e151edec51b2484cdc00242dde71958ab3b (patch) | |
tree | c16519757900ac6dfc5678982ddfb48ef49da21b /ext/bg/js/backend.js | |
parent | f997f017422bba2527e620000e3a938b916f25ac (diff) |
Cleanup unused utils (#832)
* Remove api.optionsSave
* Remove getOptionsMutable and getOptionsFullMutable
* Remove util.js
* Remove yomichanBackend
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r-- | ext/bg/js/backend.js | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index ceb1e257..54982098 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -80,7 +80,6 @@ class Backend { ['requestBackendReadySignal', {async: false, contentScript: true, handler: this._onApiRequestBackendReadySignal.bind(this)}], ['optionsGet', {async: false, contentScript: true, handler: this._onApiOptionsGet.bind(this)}], ['optionsGetFull', {async: false, contentScript: true, handler: this._onApiOptionsGetFull.bind(this)}], - ['optionsSave', {async: true, contentScript: true, handler: this._onApiOptionsSave.bind(this)}], ['kanjiFind', {async: true, contentScript: true, handler: this._onApiKanjiFind.bind(this)}], ['termsFind', {async: true, contentScript: true, handler: this._onApiTermsFind.bind(this)}], ['textParse', {async: true, contentScript: true, handler: this._onApiTextParse.bind(this)}], @@ -377,13 +376,6 @@ class Backend { return this.getFullOptions(); } - async _onApiOptionsSave({source}) { - this._clearProfileConditionsSchemaCache(); - const options = this.getFullOptions(); - await this._optionsUtil.save(options); - this._applyOptions(source); - } - async _onApiKanjiFind({text, optionsContext}) { const options = this.getOptions(optionsContext); const definitions = await this._translator.findKanji(text, options); @@ -766,7 +758,7 @@ class Backend { results.push({error: errorToJson(e)}); } } - await this._onApiOptionsSave({source}); + await this._saveOptions(source); return results; } @@ -786,7 +778,7 @@ class Backend { async _onApiSetAllSettings({value, source}) { this._optionsUtil.validate(value); this._options = clone(value); - await this._onApiOptionsSave({source}); + await this._saveOptions(source); } async _onApiGetOrCreateSearchPopup({focus=false, text=null}) { @@ -879,7 +871,7 @@ class Backend { const source = 'popup'; const options = this.getOptions({current: true}); options.general.enable = !options.general.enable; - await this._onApiOptionsSave({source}); + await this._saveOptions(source); } // Utilities @@ -1731,4 +1723,11 @@ class Backend { _triggerDatabaseUpdated(type, cause) { this._sendMessageAllTabs('databaseUpdated', {type, cause}); } + + async _saveOptions(source) { + this._clearProfileConditionsSchemaCache(); + const options = this.getFullOptions(); + await this._optionsUtil.save(options); + this._applyOptions(source); + } } |