summaryrefslogtreecommitdiff
path: root/ext/js/pages
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
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')
-rw-r--r--ext/js/pages/settings/anki-controller.js4
-rw-r--r--ext/js/pages/settings/anki-templates-controller.js2
-rw-r--r--ext/js/pages/settings/audio-controller.js6
-rw-r--r--ext/js/pages/settings/backup-controller.js4
-rw-r--r--ext/js/pages/settings/collapsible-dictionary-controller.js2
-rw-r--r--ext/js/pages/settings/dictionary-controller.js6
-rw-r--r--ext/js/pages/settings/dictionary-import-controller.js2
-rw-r--r--ext/js/pages/settings/extension-keyboard-shortcuts-controller.js2
-rw-r--r--ext/js/pages/settings/keyboard-mouse-input-field.js6
-rw-r--r--ext/js/pages/settings/keyboard-shortcuts-controller.js4
-rw-r--r--ext/js/pages/settings/nested-popups-controller.js2
-rw-r--r--ext/js/pages/settings/permissions-origin-controller.js2
-rw-r--r--ext/js/pages/settings/permissions-toggle-controller.js4
-rw-r--r--ext/js/pages/settings/persistent-storage-controller.js2
-rw-r--r--ext/js/pages/settings/popup-preview-frame.js2
-rw-r--r--ext/js/pages/settings/profile-conditions-ui.js33
-rw-r--r--ext/js/pages/settings/profile-controller.js2
-rw-r--r--ext/js/pages/settings/recommended-permissions-controller.js2
-rw-r--r--ext/js/pages/settings/scan-inputs-controller.js10
-rw-r--r--ext/js/pages/settings/scan-inputs-simple-controller.js6
-rw-r--r--ext/js/pages/settings/secondary-search-dictionary-controller.js2
-rw-r--r--ext/js/pages/settings/sentence-termination-characters-controller.js2
-rw-r--r--ext/js/pages/settings/settings-controller.js12
-rw-r--r--ext/js/pages/settings/sort-frequency-dictionary-controller.js2
-rw-r--r--ext/js/pages/settings/translation-text-replacements-controller.js2
25 files changed, 56 insertions, 67 deletions
diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js
index aea94b65..d64034a5 100644
--- a/ext/js/pages/settings/anki-controller.js
+++ b/ext/js/pages/settings/anki-controller.js
@@ -221,7 +221,7 @@ export class AnkiController {
}
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
async _onOptionsChanged({options: {anki}}) {
/** @type {?string} */
@@ -964,7 +964,7 @@ class AnkiCardController {
}
/**
- * @param {import('settings-controller').PermissionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'permissionsChanged'>} details
*/
_onPermissionsChanged({permissions: {permissions}}) {
const permissionsSet = new Set(permissions);
diff --git a/ext/js/pages/settings/anki-templates-controller.js b/ext/js/pages/settings/anki-templates-controller.js
index ac0cc9c2..56e992b0 100644
--- a/ext/js/pages/settings/anki-templates-controller.js
+++ b/ext/js/pages/settings/anki-templates-controller.js
@@ -94,7 +94,7 @@ export class AnkiTemplatesController {
// Private
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
let templates = options.anki.fieldTemplates;
diff --git a/ext/js/pages/settings/audio-controller.js b/ext/js/pages/settings/audio-controller.js
index af05ee70..2b46455f 100644
--- a/ext/js/pages/settings/audio-controller.js
+++ b/ext/js/pages/settings/audio-controller.js
@@ -21,7 +21,7 @@ import {querySelectorNotNull} from '../../dom/query-selector.js';
import {AudioSystem} from '../../media/audio-system.js';
/**
- * @augments EventDispatcher<import('audio-controller').EventType>
+ * @augments EventDispatcher<import('audio-controller').Events>
*/
export class AudioController extends EventDispatcher {
/**
@@ -117,7 +117,7 @@ export class AudioController extends EventDispatcher {
// Private
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
for (const entry of this._audioSourceEntries) {
@@ -163,7 +163,7 @@ export class AudioController extends EventDispatcher {
);
voices.sort(this._textToSpeechVoiceCompare.bind(this));
this._voices = voices;
- this.trigger('voicesUpdated');
+ this.trigger('voicesUpdated', {});
}
/**
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js
index c0e56e96..2ae52925 100644
--- a/ext/js/pages/settings/backup-controller.js
+++ b/ext/js/pages/settings/backup-controller.js
@@ -290,7 +290,7 @@ export class BackupController {
modal.setVisible(false);
};
/**
- * @param {import('panel-element').VisibilityChangedEvent} details
+ * @param {import('panel-element').EventArgument<'visibilityChanged'>} details
*/
const onModalVisibilityChanged = ({visible}) => {
if (visible) { return; }
@@ -644,7 +644,7 @@ export class BackupController {
await yomitan.api.purgeDatabase();
await Dexie.import(file, {progressCallback: this._databaseImportProgressCallback});
yomitan.api.triggerDatabaseUpdated('dictionary', 'import');
- yomitan.trigger('storageChanged');
+ yomitan.triggerStorageChanged();
}
/** */
diff --git a/ext/js/pages/settings/collapsible-dictionary-controller.js b/ext/js/pages/settings/collapsible-dictionary-controller.js
index cff3ad20..341522cf 100644
--- a/ext/js/pages/settings/collapsible-dictionary-controller.js
+++ b/ext/js/pages/settings/collapsible-dictionary-controller.js
@@ -70,7 +70,7 @@ export class CollapsibleDictionaryController {
}
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
this._eventListeners.removeAllEventListeners();
diff --git a/ext/js/pages/settings/dictionary-controller.js b/ext/js/pages/settings/dictionary-controller.js
index db6a73d4..0132fe9e 100644
--- a/ext/js/pages/settings/dictionary-controller.js
+++ b/ext/js/pages/settings/dictionary-controller.js
@@ -473,7 +473,7 @@ export class DictionaryController {
value: dictionaries
}]);
- /** @type {import('settings-controller').DictionarySettingsReorderedEvent} */
+ /** @type {import('settings-controller').EventArgument<'dictionarySettingsReordered'>} */
const event = {source: this};
this._settingsController.trigger('dictionarySettingsReordered', event);
@@ -577,7 +577,7 @@ export class DictionaryController {
// Private
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
this._updateDictionariesEnabledWarnings(options);
@@ -930,7 +930,7 @@ export class DictionaryController {
/** */
_triggerStorageChanged() {
- yomitan.trigger('storageChanged');
+ yomitan.triggerStorageChanged();
}
/** */
diff --git a/ext/js/pages/settings/dictionary-import-controller.js b/ext/js/pages/settings/dictionary-import-controller.js
index 79a62d32..eadfcb91 100644
--- a/ext/js/pages/settings/dictionary-import-controller.js
+++ b/ext/js/pages/settings/dictionary-import-controller.js
@@ -398,6 +398,6 @@ export class DictionaryImportController {
/** */
_triggerStorageChanged() {
- yomitan.trigger('storageChanged');
+ yomitan.triggerStorageChanged();
}
}
diff --git a/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js b/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js
index e92d9e93..e3d84ac2 100644
--- a/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js
+++ b/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js
@@ -313,7 +313,7 @@ class ExtensionKeyboardShortcutHotkeyEntry {
// Private
/**
- * @param {import('keyboard-mouse-input-field').ChangeEvent} e
+ * @param {import('keyboard-mouse-input-field').EventArgument<'change'>} e
*/
_onInputFieldChange(e) {
const {key, modifiers} = e;
diff --git a/ext/js/pages/settings/keyboard-mouse-input-field.js b/ext/js/pages/settings/keyboard-mouse-input-field.js
index f50ca112..0628d065 100644
--- a/ext/js/pages/settings/keyboard-mouse-input-field.js
+++ b/ext/js/pages/settings/keyboard-mouse-input-field.js
@@ -21,7 +21,7 @@ import {DocumentUtil} from '../../dom/document-util.js';
import {HotkeyUtil} from '../../input/hotkey-util.js';
/**
- * @augments EventDispatcher<import('keyboard-mouse-input-field').EventType>
+ * @augments EventDispatcher<import('keyboard-mouse-input-field').Events>
*/
export class KeyboardMouseInputField extends EventDispatcher {
/**
@@ -308,9 +308,7 @@ export class KeyboardMouseInputField extends EventDispatcher {
this._updateDisplayString();
if (changed) {
- /** @type {import('keyboard-mouse-input-field').ChangeEvent} */
- const event = {modifiers: this._modifiers, key: this._key};
- this.trigger('change', event);
+ this.trigger('change', {modifiers: this._modifiers, key: this._key});
}
}
diff --git a/ext/js/pages/settings/keyboard-shortcuts-controller.js b/ext/js/pages/settings/keyboard-shortcuts-controller.js
index cbdae77d..b45c656a 100644
--- a/ext/js/pages/settings/keyboard-shortcuts-controller.js
+++ b/ext/js/pages/settings/keyboard-shortcuts-controller.js
@@ -160,7 +160,7 @@ export class KeyboardShortcutController {
// Private
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
for (const entry of this._entries) {
@@ -395,7 +395,7 @@ class KeyboardShortcutHotkeyEntry {
}
/**
- * @param {import('keyboard-mouse-input-field').ChangeEvent} details
+ * @param {import('keyboard-mouse-input-field').EventArgument<'change'>} details
*/
_onInputFieldChange({key, modifiers}) {
/** @type {import('input').ModifierKey[]} */
diff --git a/ext/js/pages/settings/nested-popups-controller.js b/ext/js/pages/settings/nested-popups-controller.js
index 7eb78148..4f0aa761 100644
--- a/ext/js/pages/settings/nested-popups-controller.js
+++ b/ext/js/pages/settings/nested-popups-controller.js
@@ -50,7 +50,7 @@ export class NestedPopupsController {
// Private
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
this._updatePopupNestingMaxDepth(options.scanning.popupNestingMaxDepth);
diff --git a/ext/js/pages/settings/permissions-origin-controller.js b/ext/js/pages/settings/permissions-origin-controller.js
index 6dacced8..3a9db602 100644
--- a/ext/js/pages/settings/permissions-origin-controller.js
+++ b/ext/js/pages/settings/permissions-origin-controller.js
@@ -60,7 +60,7 @@ export class PermissionsOriginController {
// Private
/**
- * @param {import('settings-controller').PermissionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'permissionsChanged'>} details
*/
_onPermissionsChanged({permissions}) {
this._eventListeners.removeAllEventListeners();
diff --git a/ext/js/pages/settings/permissions-toggle-controller.js b/ext/js/pages/settings/permissions-toggle-controller.js
index 85752a7e..055ce1f4 100644
--- a/ext/js/pages/settings/permissions-toggle-controller.js
+++ b/ext/js/pages/settings/permissions-toggle-controller.js
@@ -47,7 +47,7 @@ export class PermissionsToggleController {
// Private
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
let accessor = null;
@@ -104,7 +104,7 @@ export class PermissionsToggleController {
}
/**
- * @param {import('settings-controller').PermissionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'permissionsChanged'>} details
*/
_onPermissionsChanged({permissions}) {
const permissions2 = permissions.permissions;
diff --git a/ext/js/pages/settings/persistent-storage-controller.js b/ext/js/pages/settings/persistent-storage-controller.js
index 7386edd7..70c9a177 100644
--- a/ext/js/pages/settings/persistent-storage-controller.js
+++ b/ext/js/pages/settings/persistent-storage-controller.js
@@ -82,7 +82,7 @@ export class PersistentStorageController {
const node = document.querySelector('#storage-persistent-fail-warning');
if (node !== null) { node.hidden = isStoragePeristent; }
- yomitan.trigger('storageChanged');
+ yomitan.triggerStorageChanged();
}
/**
diff --git a/ext/js/pages/settings/popup-preview-frame.js b/ext/js/pages/settings/popup-preview-frame.js
index 7828a025..609710ba 100644
--- a/ext/js/pages/settings/popup-preview-frame.js
+++ b/ext/js/pages/settings/popup-preview-frame.js
@@ -140,7 +140,7 @@ export class PopupPreviewFrame {
}
/**
- * @param {import('popup').CustomOuterCssChangedEvent} details
+ * @param {import('popup').EventArgument<'customOuterCssChanged'>} details
*/
_onCustomOuterCssChanged({node, inShadow}) {
if (node === null || inShadow) { return; }
diff --git a/ext/js/pages/settings/profile-conditions-ui.js b/ext/js/pages/settings/profile-conditions-ui.js
index 29e7460f..22e47a9b 100644
--- a/ext/js/pages/settings/profile-conditions-ui.js
+++ b/ext/js/pages/settings/profile-conditions-ui.js
@@ -22,7 +22,7 @@ import {querySelectorNotNull} from '../../dom/query-selector.js';
import {KeyboardMouseInputField} from './keyboard-mouse-input-field.js';
/**
- * @augments EventDispatcher<import('profile-conditions-ui').EventType>
+ * @augments EventDispatcher<import('profile-conditions-ui').Events>
*/
export class ProfileConditionsUI extends EventDispatcher {
/**
@@ -440,9 +440,7 @@ export class ProfileConditionsUI extends EventDispatcher {
* @param {number} count
*/
_triggerConditionGroupCountChanged(count) {
- /** @type {import('profile-conditions-ui').ConditionGroupCountChangedEvent} */
- const event = {count, profileIndex: this._profileIndex};
- this.trigger('conditionGroupCountChanged', event);
+ this.trigger('conditionGroupCountChanged', {count, profileIndex: this._profileIndex});
}
}
@@ -747,7 +745,7 @@ class ProfileConditionUI {
/**
* @param {import('profile-conditions-ui').InputData} details
- * @param {import('keyboard-mouse-input-field').ChangeEvent} event
+ * @param {import('keyboard-mouse-input-field').EventArgument<'change'>} event
*/
_onModifierInputChange({validate, normalize}, event) {
const modifiers = this._joinModifiers(event.modifiers);
@@ -863,10 +861,6 @@ class ProfileConditionUI {
let inputValue = value;
let inputStep = null;
let showMouseButton = false;
- /** @type {import('event-listener-collection').AddEventListenerArgs[]} */
- const events1 = [];
- /** @type {import('event-listener-collection').OnArgs[]} */
- const events2 = [];
/** @type {import('profile-conditions-ui').InputData} */
const inputData = {validate, normalize};
const node = this._valueInput;
@@ -875,7 +869,6 @@ class ProfileConditionUI {
case 'integer':
inputType = 'number';
inputStep = '1';
- events1.push([node, 'change', this._onValueInputChange.bind(this, inputData), false]);
break;
case 'modifierKeys':
case 'modifierInputs':
@@ -883,10 +876,6 @@ class ProfileConditionUI {
showMouseButton = (type === 'modifierInputs');
this._kbmInputField = this._parent.parent.createKeyboardMouseInputField(node, this._mouseButton);
this._kbmInputField.prepare(null, this._splitModifiers(value), showMouseButton, false);
- events2.push([this._kbmInputField, 'change', this._onModifierInputChange.bind(this, inputData)]);
- break;
- default: // 'string'
- events1.push([node, 'change', this._onValueInputChange.bind(this, inputData), false]);
break;
}
@@ -902,11 +891,17 @@ class ProfileConditionUI {
node.removeAttribute('step');
}
this._mouseButtonContainer.hidden = !showMouseButton;
- for (const args of events1) {
- this._inputEventListeners.addEventListener(...args);
- }
- for (const args of events2) {
- this._inputEventListeners.on(...args);
+
+ switch (type) {
+ case 'modifierKeys':
+ case 'modifierInputs':
+ if (this._kbmInputField !== null) {
+ this._inputEventListeners.on(this._kbmInputField, 'change', this._onModifierInputChange.bind(this, inputData));
+ }
+ break;
+ default: // 'integer', 'string'
+ this._inputEventListeners.addEventListener(node, 'change', this._onValueInputChange.bind(this, inputData), false);
+ break;
}
return this._validateValue(value, validate);
diff --git a/ext/js/pages/settings/profile-controller.js b/ext/js/pages/settings/profile-controller.js
index c54bfe73..54a41058 100644
--- a/ext/js/pages/settings/profile-controller.js
+++ b/ext/js/pages/settings/profile-controller.js
@@ -475,7 +475,7 @@ export class ProfileController {
}
/**
- * @param {import('profile-conditions-ui').ConditionGroupCountChangedEvent} details
+ * @param {import('profile-conditions-ui').EventArgument<'conditionGroupCountChanged'>} details
*/
_onConditionGroupCountChanged({count, profileIndex}) {
if (profileIndex >= 0 && profileIndex < this._profileEntryList.length) {
diff --git a/ext/js/pages/settings/recommended-permissions-controller.js b/ext/js/pages/settings/recommended-permissions-controller.js
index b19311aa..a870de50 100644
--- a/ext/js/pages/settings/recommended-permissions-controller.js
+++ b/ext/js/pages/settings/recommended-permissions-controller.js
@@ -48,7 +48,7 @@ export class RecommendedPermissionsController {
// Private
/**
- * @param {import('settings-controller').PermissionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'permissionsChanged'>} details
*/
_onPermissionsChanged({permissions}) {
this._eventListeners.removeAllEventListeners();
diff --git a/ext/js/pages/settings/scan-inputs-controller.js b/ext/js/pages/settings/scan-inputs-controller.js
index eb526863..4854c28f 100644
--- a/ext/js/pages/settings/scan-inputs-controller.js
+++ b/ext/js/pages/settings/scan-inputs-controller.js
@@ -110,7 +110,7 @@ export class ScanInputsController {
// Private
/**
- * @param {import('settings-controller').ScanInputsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'scanInputsChanged'>} details
*/
_onScanInputsChanged({source}) {
if (source === this) { return; }
@@ -118,7 +118,7 @@ export class ScanInputsController {
}
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
const {inputs} = options.scanning;
@@ -190,7 +190,7 @@ export class ScanInputsController {
/** */
_triggerScanInputsChanged() {
- /** @type {import('settings-controller').ScanInputsChangedEvent} */
+ /** @type {import('settings-controller').EventArgument<'scanInputsChanged'>} */
const event = {source: this};
this._settingsController.trigger('scanInputsChanged', event);
}
@@ -312,7 +312,7 @@ class ScanInputField {
// Private
/**
- * @param {import('keyboard-mouse-input-field').ChangeEvent} details
+ * @param {import('keyboard-mouse-input-field').EventArgument<'change'>} details
*/
_onIncludeValueChange({modifiers}) {
const modifiers2 = this._joinModifiers(modifiers);
@@ -320,7 +320,7 @@ class ScanInputField {
}
/**
- * @param {import('keyboard-mouse-input-field').ChangeEvent} details
+ * @param {import('keyboard-mouse-input-field').EventArgument<'change'>} details
*/
_onExcludeValueChange({modifiers}) {
const modifiers2 = this._joinModifiers(modifiers);
diff --git a/ext/js/pages/settings/scan-inputs-simple-controller.js b/ext/js/pages/settings/scan-inputs-simple-controller.js
index ddb68825..f0255595 100644
--- a/ext/js/pages/settings/scan-inputs-simple-controller.js
+++ b/ext/js/pages/settings/scan-inputs-simple-controller.js
@@ -67,7 +67,7 @@ export class ScanInputsSimpleController {
// Private
/**
- * @param {import('settings-controller').ScanInputsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'scanInputsChanged'>} details
*/
_onScanInputsChanged({source}) {
if (source === this) { return; }
@@ -75,7 +75,7 @@ export class ScanInputsSimpleController {
}
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
const {scanning: {inputs}} = options;
@@ -236,7 +236,7 @@ export class ScanInputsSimpleController {
*/
async _modifyProfileSettings(targets) {
await this._settingsController.modifyProfileSettings(targets);
- /** @type {import('settings-controller').ScanInputsChangedEvent} */
+ /** @type {import('settings-controller').EventArgument<'scanInputsChanged'>} */
const event = {source: this};
this._settingsController.trigger('scanInputsChanged', event);
}
diff --git a/ext/js/pages/settings/secondary-search-dictionary-controller.js b/ext/js/pages/settings/secondary-search-dictionary-controller.js
index f24f6ea3..7f0882b8 100644
--- a/ext/js/pages/settings/secondary-search-dictionary-controller.js
+++ b/ext/js/pages/settings/secondary-search-dictionary-controller.js
@@ -66,7 +66,7 @@ export class SecondarySearchDictionaryController {
}
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
this._eventListeners.removeAllEventListeners();
diff --git a/ext/js/pages/settings/sentence-termination-characters-controller.js b/ext/js/pages/settings/sentence-termination-characters-controller.js
index 7fd90b28..f7793943 100644
--- a/ext/js/pages/settings/sentence-termination-characters-controller.js
+++ b/ext/js/pages/settings/sentence-termination-characters-controller.js
@@ -105,7 +105,7 @@ export class SentenceTerminationCharactersController {
// Private
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
for (const entry of this._entries) {
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});
}
/**
diff --git a/ext/js/pages/settings/sort-frequency-dictionary-controller.js b/ext/js/pages/settings/sort-frequency-dictionary-controller.js
index 2c56f023..3fdd66c7 100644
--- a/ext/js/pages/settings/sort-frequency-dictionary-controller.js
+++ b/ext/js/pages/settings/sort-frequency-dictionary-controller.js
@@ -68,7 +68,7 @@ export class SortFrequencyDictionaryController {
}
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
const {sortFrequencyDictionary, sortFrequencyDictionaryOrder} = options.general;
diff --git a/ext/js/pages/settings/translation-text-replacements-controller.js b/ext/js/pages/settings/translation-text-replacements-controller.js
index ebd1b58d..9f3fda00 100644
--- a/ext/js/pages/settings/translation-text-replacements-controller.js
+++ b/ext/js/pages/settings/translation-text-replacements-controller.js
@@ -110,7 +110,7 @@ export class TranslationTextReplacementsController {
// Private
/**
- * @param {import('settings-controller').OptionsChangedEvent} details
+ * @param {import('settings-controller').EventArgument<'optionsChanged'>} details
*/
_onOptionsChanged({options}) {
for (const entry of this._entries) {