From 1e254fd1d4423b984e176547ef36a14383bbd7f5 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 28 Dec 2023 22:17:38 -0500 Subject: 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 --- ext/js/app/popup-proxy.js | 4 ++-- ext/js/app/popup-window.js | 2 +- ext/js/app/popup.js | 8 +++----- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'ext/js/app') diff --git a/ext/js/app/popup-proxy.js b/ext/js/app/popup-proxy.js index 924175e2..d141d35b 100644 --- a/ext/js/app/popup-proxy.js +++ b/ext/js/app/popup-proxy.js @@ -22,7 +22,7 @@ import {yomitan} from '../yomitan.js'; /** * This class is a proxy for a Popup that is hosted in a different frame. * It effectively forwards all API calls to the underlying Popup. - * @augments EventDispatcher + * @augments EventDispatcher */ export class PopupProxy extends EventDispatcher { /** @@ -361,7 +361,7 @@ export class PopupProxy extends EventDispatcher { } else { this._frameOffsetX = 0; this._frameOffsetY = 0; - this.trigger('offsetNotFound'); + this.trigger('offsetNotFound', {}); return; } this._frameOffsetUpdatedAt = now; diff --git a/ext/js/app/popup-window.js b/ext/js/app/popup-window.js index 9a0f8011..0b083d80 100644 --- a/ext/js/app/popup-window.js +++ b/ext/js/app/popup-window.js @@ -21,7 +21,7 @@ import {yomitan} from '../yomitan.js'; /** * This class represents a popup that is hosted in a new native window. - * @augments EventDispatcher + * @augments EventDispatcher */ export class PopupWindow extends EventDispatcher { /** diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js index a0712604..4f2368d4 100644 --- a/ext/js/app/popup.js +++ b/ext/js/app/popup.js @@ -26,7 +26,7 @@ import {ThemeController} from './theme-controller.js'; /** * This class is the container which hosts the display of search results. - * @augments EventDispatcher + * @augments EventDispatcher */ export class Popup extends EventDispatcher { /** @@ -360,9 +360,7 @@ export class Popup extends EventDispatcher { parentNode = this._shadow; } const node = await loadStyle('yomitan-popup-outer-user-stylesheet', 'code', css, useWebExtensionApi, parentNode); - /** @type {import('popup').CustomOuterCssChangedEvent} */ - const event = {node, useWebExtensionApi, inShadow}; - this.trigger('customOuterCssChanged', event); + this.trigger('customOuterCssChanged', {node, useWebExtensionApi, inShadow}); } /** @@ -653,7 +651,7 @@ export class Popup extends EventDispatcher { } /** - * @param {import('dynamic-property').ChangeEventDetails} event + * @param {import('dynamic-property').EventArgument} event */ _onVisibleChange({value}) { if (this._visibleValue === value) { return; } -- cgit v1.2.3