summaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/settings-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-28 22:17:38 -0500
committerGitHub <noreply@github.com>2023-12-29 03:17:38 +0000
commit1e254fd1d4423b984e176547ef36a14383bbd7f5 (patch)
tree8aae2c47f80265d5f1f39c927e19455ec3986387 /ext/js/pages/settings/settings-controller.js
parenta51ae1533c54162f14785652e9128f90afb86aed (diff)
Event dispatcher refactor (#463)
* Refactor EventDispatcher template type * Update core types * Update log * Update clipboard monitor * Update application events * Update popup events * Update text scanner * Update cross frame API * Update display events * Type updates * Update display history * Update query parser * Update search persistent state controller * Update panel element * Update popup menu * Update audio system * Update hotkey handler * Update settings controller * Update audio controller * Update types * Update types * Update types * Add event handler types * Update type * Fix issues * Remove error suppression * Fix typo
Diffstat (limited to 'ext/js/pages/settings/settings-controller.js')
-rw-r--r--ext/js/pages/settings/settings-controller.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/ext/js/pages/settings/settings-controller.js b/ext/js/pages/settings/settings-controller.js
index 1b46c745..52b777a3 100644
--- a/ext/js/pages/settings/settings-controller.js
+++ b/ext/js/pages/settings/settings-controller.js
@@ -23,7 +23,7 @@ import {HtmlTemplateCollection} from '../../dom/html-template-collection.js';
import {yomitan} from '../../yomitan.js';
/**
- * @augments EventDispatcher<import('settings-controller').EventType>
+ * @augments EventDispatcher<import('settings-controller').Events>
*/
export class SettingsController extends EventDispatcher {
constructor() {
@@ -234,7 +234,7 @@ export class SettingsController extends EventDispatcher {
*/
_setProfileIndex(value, canUpdateProfileIndex) {
this._profileIndex = value;
- this.trigger('optionsContextChanged');
+ this.trigger('optionsContextChanged', {});
this._onOptionsUpdatedInternal(canUpdateProfileIndex);
}
@@ -253,9 +253,7 @@ export class SettingsController extends EventDispatcher {
const optionsContext = this.getOptionsContext();
try {
const options = await this.getOptions();
- /** @type {import('settings-controller').OptionsChangedEvent} */
- const event = {options, optionsContext};
- this.trigger('optionsChanged', event);
+ this.trigger('optionsChanged', {options, optionsContext});
} catch (e) {
if (canUpdateProfileIndex) {
this._setProfileIndex(0, false);
@@ -339,9 +337,7 @@ export class SettingsController extends EventDispatcher {
if (!this.hasListeners(eventName)) { return; }
const permissions = await this._permissionsUtil.getAllPermissions();
- /** @type {import('settings-controller').PermissionsChangedEvent} */
- const event = {permissions};
- this.trigger(eventName, event);
+ this.trigger(eventName, {permissions});
}
/**