blob: a37b39469328dccc6e74e07eee990dc72e72cc89 [file] [log] [blame]
import MainWorldContentScriptBridgeClient from '../mainWorldContentScriptBridge/Client.js';
// Main World OptionsWatcher client (used in scripts injected into the Main
// World (MW) to get the options).
export default class MWOptionsWatcherClient extends
MainWorldContentScriptBridgeClient {
constructor(options, CSTarget, MWTarget, timeout) {
super(CSTarget, MWTarget, timeout);
this.#setUp(options);
}
#setUp(options) {
this._sendRequestWithoutCallback('setUp', {options});
}
async getOption(option) {
if (!option) return null;
return this._sendRequest('getOption', {option});
}
async getOptions(options) {
if (!options || options?.length === 0) return [];
return this._sendRequest('getOptions', {options});
}
async isEnabled(option) {
if (!option) return null;
return this._sendRequest('isEnabled', {option});
}
async areEnabled(options) {
if (!options || options?.length === 0) return [];
return this._sendRequest('areEnabled', {options});
}
}