Fix options reference being changed
This commit is contained in:
parent
1f8c7358cb
commit
87e513dd77
@ -25,7 +25,7 @@ async function apiOptionsSave() {
|
|||||||
const backend = utilBackend();
|
const backend = utilBackend();
|
||||||
const options = await backend.getFullOptions();
|
const options = await backend.getFullOptions();
|
||||||
await optionsSave(options);
|
await optionsSave(options);
|
||||||
backend.onOptionsUpdated(options);
|
backend.onOptionsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function apiTermsFind(text, optionsContext) {
|
async function apiTermsFind(text, optionsContext) {
|
||||||
|
@ -34,7 +34,8 @@ class Backend {
|
|||||||
|
|
||||||
async prepare() {
|
async prepare() {
|
||||||
await this.translator.prepare();
|
await this.translator.prepare();
|
||||||
this.onOptionsUpdated(await optionsLoad());
|
this.options = await optionsLoad();
|
||||||
|
this.onOptionsUpdated();
|
||||||
|
|
||||||
if (chrome.commands !== null && typeof chrome.commands === 'object') {
|
if (chrome.commands !== null && typeof chrome.commands === 'object') {
|
||||||
chrome.commands.onCommand.addListener(this.onCommand.bind(this));
|
chrome.commands.onCommand.addListener(this.onCommand.bind(this));
|
||||||
@ -51,8 +52,7 @@ class Backend {
|
|||||||
this.isPreparedPromise = null;
|
this.isPreparedPromise = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
onOptionsUpdated(options) {
|
onOptionsUpdated() {
|
||||||
this.options = utilIsolate(options);
|
|
||||||
this.applyOptions();
|
this.applyOptions();
|
||||||
|
|
||||||
const callback = () => this.checkLastError(chrome.runtime.lastError);
|
const callback = () => this.checkLastError(chrome.runtime.lastError);
|
||||||
|
Loading…
Reference in New Issue
Block a user