aboutsummaryrefslogtreecommitdiff
path: root/ext/js/input/hotkey-handler.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/input/hotkey-handler.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/input/hotkey-handler.js')
-rw-r--r--ext/js/input/hotkey-handler.js22
1 files changed, 9 insertions, 13 deletions
diff --git a/ext/js/input/hotkey-handler.js b/ext/js/input/hotkey-handler.js
index da763662..48c2de57 100644
--- a/ext/js/input/hotkey-handler.js
+++ b/ext/js/input/hotkey-handler.js
@@ -22,7 +22,7 @@ import {yomitan} from '../yomitan.js';
/**
* Class which handles hotkey events and actions.
- * @augments EventDispatcher<import('hotkey-handler').EventType>
+ * @augments EventDispatcher<import('hotkey-handler').Events>
*/
export class HotkeyHandler extends EventDispatcher {
/**
@@ -120,25 +120,21 @@ export class HotkeyHandler extends EventDispatcher {
}
/**
- * Adds a single event listener to a specific event.
- * @template [TEventDetails=unknown]
- * @param {import('hotkey-handler').EventType} eventName The string representing the event's name.
- * @param {(details: TEventDetails) => void} callback The event listener callback to add.
- * @returns {void}
+ * @template {import('core').EventNames<import('hotkey-handler').Events>} TName
+ * @param {TName} eventName
+ * @param {(details: import('core').EventArgument<import('hotkey-handler').Events, TName>) => void} callback
*/
on(eventName, callback) {
- const result = super.on(eventName, callback);
+ super.on(eventName, callback);
this._updateHasEventListeners();
this._updateEventHandlers();
- return result;
}
/**
- * Removes a single event listener from a specific event.
- * @template [TEventDetails=unknown]
- * @param {import('hotkey-handler').EventType} eventName The string representing the event's name.
- * @param {(details: TEventDetails) => void} callback The event listener callback to add.
- * @returns {boolean} `true` if the callback was removed, `false` otherwise.
+ * @template {import('core').EventNames<import('hotkey-handler').Events>} TName
+ * @param {TName} eventName
+ * @param {(details: import('core').EventArgument<import('hotkey-handler').Events, TName>) => void} callback
+ * @returns {boolean}
*/
off(eventName, callback) {
const result = super.off(eventName, callback);