aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/display')
-rw-r--r--ext/js/display/display-anki.js6
-rw-r--r--ext/js/display/display-audio.js8
-rw-r--r--ext/js/display/display-history.js4
-rw-r--r--ext/js/display/display.js32
-rw-r--r--ext/js/display/query-parser.js8
-rw-r--r--ext/js/display/search-display-controller.js4
-rw-r--r--ext/js/display/search-persistent-state-controller.js2
7 files changed, 25 insertions, 39 deletions
diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js
index 423cdfdc..759998c4 100644
--- a/ext/js/display/display-anki.js
+++ b/ext/js/display/display-anki.js
@@ -182,7 +182,7 @@ export class DisplayAnki {
// Private
/**
- * @param {import('display').OptionsUpdatedEvent} details
+ * @param {import('display').EventArgument<'optionsUpdated'>} details
*/
_onOptionsUpdated({options}) {
const {
@@ -238,7 +238,7 @@ export class DisplayAnki {
}
/**
- * @param {import('display').ContentUpdateEntryEvent} details
+ * @param {import('display').EventArgument<'contentUpdateEntry'>} details
*/
_onContentUpdateEntry({element}) {
const eventListeners = this._eventListeners;
@@ -261,7 +261,7 @@ export class DisplayAnki {
}
/**
- * @param {import('display').LogDictionaryEntryDataEvent} details
+ * @param {import('display').EventArgument<'logDictionaryEntryData'>} details
*/
_onLogDictionaryEntryData({dictionaryEntry, promises}) {
promises.push(this.getLogData(dictionaryEntry));
diff --git a/ext/js/display/display-audio.js b/ext/js/display/display-audio.js
index 30cf2b92..cba9c43c 100644
--- a/ext/js/display/display-audio.js
+++ b/ext/js/display/display-audio.js
@@ -162,7 +162,7 @@ export class DisplayAudio {
// Private
/**
- * @param {import('display').OptionsUpdatedEvent} details
+ * @param {import('display').EventArgument<'optionsUpdated'>} details
*/
_onOptionsUpdated({options}) {
const {enabled, autoPlay, volume, sources} = options.audio;
@@ -201,7 +201,7 @@ export class DisplayAudio {
}
/**
- * @param {import('display').ContentUpdateEntryEvent} details
+ * @param {import('display').EventArgument<'contentUpdateEntry'>} details
*/
_onContentUpdateEntry({element}) {
const eventListeners = this._eventListeners;
@@ -237,7 +237,7 @@ export class DisplayAudio {
}
/**
- * @param {import('display').FrameVisibilityChangeEvent} details
+ * @param {import('display').EventArgument<'frameVisibilityChange'>} details
*/
_onFrameVisibilityChange({value}) {
if (!value) {
@@ -779,7 +779,7 @@ export class DisplayAudio {
}
/**
- * @param {import('popup-menu').MenuCloseEventDetails} details
+ * @param {import('popup-menu').EventArgument<'close'>} details
*/
_onPopupMenuClose({menu}) {
this._openMenus.delete(menu);
diff --git a/ext/js/display/display-history.js b/ext/js/display/display-history.js
index af6d734e..30bc3eec 100644
--- a/ext/js/display/display-history.js
+++ b/ext/js/display/display-history.js
@@ -19,7 +19,7 @@
import {EventDispatcher, generateId, isObject} from '../core.js';
/**
- * @augments EventDispatcher<import('display-history').EventType>
+ * @augments EventDispatcher<import('display-history').Events>
*/
export class DisplayHistory extends EventDispatcher {
/**
@@ -161,7 +161,7 @@ export class DisplayHistory extends EventDispatcher {
* @param {boolean} synthetic
*/
_triggerStateChanged(synthetic) {
- this.trigger('stateChanged', /** @type {import('display-history').StateChangedEvent} */ ({synthetic}));
+ this.trigger('stateChanged', {synthetic});
}
/**
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index 79cf79a8..08f640d0 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -34,7 +34,7 @@ import {OptionToggleHotkeyHandler} from './option-toggle-hotkey-handler.js';
import {QueryParser} from './query-parser.js';
/**
- * @augments EventDispatcher<import('display').DisplayEventType>
+ * @augments EventDispatcher<import('display').Events>
*/
export class Display extends EventDispatcher {
/**
@@ -449,9 +449,7 @@ export class Display extends EventDispatcher {
this._updateNestedFrontend(options);
this._updateContentTextScanner(options);
- /** @type {import('display').OptionsUpdatedEvent} */
- const event = {options};
- this.trigger('optionsUpdated', event);
+ this.trigger('optionsUpdated', {options});
}
/**
@@ -716,9 +714,7 @@ export class Display extends EventDispatcher {
*/
_onMessageVisibilityChanged({value}) {
this._frameVisible = value;
- /** @type {import('display').FrameVisibilityChangeEvent} */
- const event = {value};
- this.trigger('frameVisibilityChange', event);
+ this.trigger('frameVisibilityChange', {value});
}
/** */
@@ -796,7 +792,7 @@ export class Display extends EventDispatcher {
}
/**
- * @param {import('display').QueryParserSearchedEvent} details
+ * @param {import('query-parser').EventArgument<'searched'>} details
*/
_onQueryParserSearch({type, dictionaryEntries, sentence, inputInfo: {eventType}, textSource, optionsContext, sentenceOffset}) {
const query = textSource.text();
@@ -869,7 +865,7 @@ export class Display extends EventDispatcher {
}
/**
- * @param {import('dynamic-property').ChangeEventDetails<boolean>} details
+ * @param {import('dynamic-property').EventArgument<boolean, 'change'>} details
*/
_onProgressIndicatorVisibleChanged({value}) {
if (this._progressIndicatorTimer !== null) {
@@ -1646,7 +1642,7 @@ export class Display extends EventDispatcher {
/** */
_closePopups() {
- yomitan.trigger('closePopups');
+ yomitan.triggerClosePopups();
}
/**
@@ -2011,9 +2007,7 @@ export class Display extends EventDispatcher {
/** @type {Promise<unknown>[]} */
const promises = [];
- /** @type {import('display').LogDictionaryEntryDataEvent} */
- const event = {dictionaryEntry, promises};
- this.trigger('logDictionaryEntryData', event);
+ this.trigger('logDictionaryEntryData', {dictionaryEntry, promises});
if (promises.length > 0) {
for (const result2 of await Promise.all(promises)) {
Object.assign(result, result2);
@@ -2031,9 +2025,7 @@ export class Display extends EventDispatcher {
/** */
_triggerContentUpdateStart() {
- /** @type {import('display').ContentUpdateStartEvent} */
- const event = {type: this._contentType, query: this._query};
- this.trigger('contentUpdateStart', event);
+ this.trigger('contentUpdateStart', {type: this._contentType, query: this._query});
}
/**
@@ -2042,15 +2034,11 @@ export class Display extends EventDispatcher {
* @param {number} index
*/
_triggerContentUpdateEntry(dictionaryEntry, element, index) {
- /** @type {import('display').ContentUpdateEntryEvent} */
- const event = {dictionaryEntry, element, index};
- this.trigger('contentUpdateEntry', event);
+ this.trigger('contentUpdateEntry', {dictionaryEntry, element, index});
}
/** */
_triggerContentUpdateComplete() {
- /** @type {import('display').ContentUpdateCompleteEvent} */
- const event = {type: this._contentType};
- this.trigger('contentUpdateComplete', event);
+ this.trigger('contentUpdateComplete', {type: this._contentType});
}
}
diff --git a/ext/js/display/query-parser.js b/ext/js/display/query-parser.js
index 0e7e1e1a..11c5a4ec 100644
--- a/ext/js/display/query-parser.js
+++ b/ext/js/display/query-parser.js
@@ -22,7 +22,7 @@ import {TextScanner} from '../language/text-scanner.js';
import {yomitan} from '../yomitan.js';
/**
- * @augments EventDispatcher<import('display').QueryParserEventType>
+ * @augments EventDispatcher<import('query-parser').Events>
*/
export class QueryParser extends EventDispatcher {
/**
@@ -160,8 +160,7 @@ export class QueryParser extends EventDispatcher {
} = e;
if (type === null || dictionaryEntries === null || sentence === null || optionsContext === null) { return; }
- /** @type {import('display').QueryParserSearchedEvent} */
- const event2 = {
+ this.trigger('searched', {
textScanner,
type,
dictionaryEntries,
@@ -170,8 +169,7 @@ export class QueryParser extends EventDispatcher {
textSource,
optionsContext,
sentenceOffset: this._getSentenceOffset(e.textSource)
- };
- this.trigger('searched', event2);
+ });
}
/**
diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js
index 6767d201..3df3a332 100644
--- a/ext/js/display/search-display-controller.js
+++ b/ext/js/display/search-display-controller.js
@@ -183,7 +183,7 @@ export class SearchDisplayController {
}
/**
- * @param {import('display').OptionsUpdatedEvent} details
+ * @param {import('display').EventArgument<'optionsUpdated'>} details
*/
_onDisplayOptionsUpdated({options}) {
this._clipboardMonitorEnabled = options.clipboard.enableSearchPageMonitor;
@@ -195,7 +195,7 @@ export class SearchDisplayController {
}
/**
- * @param {import('display').ContentUpdateStartEvent} details
+ * @param {import('display').EventArgument<'contentUpdateStart'>} details
*/
_onContentUpdateStart({type, query}) {
let animate = false;
diff --git a/ext/js/display/search-persistent-state-controller.js b/ext/js/display/search-persistent-state-controller.js
index d92ddf68..1bd32f5b 100644
--- a/ext/js/display/search-persistent-state-controller.js
+++ b/ext/js/display/search-persistent-state-controller.js
@@ -19,7 +19,7 @@
import {EventDispatcher} from '../core.js';
/**
- * @augments EventDispatcher<import('display').SearchPersistentStateControllerEventType>
+ * @augments EventDispatcher<import('search-persistent-state-controller').Events>
*/
export class SearchPersistentStateController extends EventDispatcher {
constructor() {