Skip to content

Conversation

@Maschina
Copy link
Contributor

@Maschina Maschina commented May 5, 2025

This PR adds a new function to remove the handler of a distinct keyboard shortcut. It extends to public function removeAllHandlers() for a more fine-granular control.

My app needs to unload a certain number of models that contain registered shortcuts. Once the module is unloaded, the shortcut should be unregistered. The removeAllHandlers does not give me the control to unregister only certain shortcuts.

@Maschina Maschina changed the title Remove handler of a keyboard shortcut Remove handler of distinct keyboard shortcut May 5, 2025
@sindresorhus
Copy link
Owner

Duplicate of #194

@sindresorhus sindresorhus marked this as a duplicate of #194 May 5, 2025
@Maschina
Copy link
Contributor Author

Maschina commented May 5, 2025

How about marking keyUp/keyDown related functions as deprecated?
I suggest continuing to facilitate PRs for legacy code as long as it is not officially marked as deprecated.

What do you think?

@sindresorhus
Copy link
Owner

Alright. I will accept this. But I don't plan any more changes to the old keyboard handling. I don't want to maintain code I don't use and that will be removed in a few years.

@Maschina
Copy link
Contributor Author

Maschina commented May 6, 2025

OK, makes sense.
Should we plan a PR to mark the planned deprecation?

@Maschina Maschina requested a review from sindresorhus May 6, 2025 12:50
@sindresorhus
Copy link
Owner

Should we plan a PR to mark the planned deprecation?

Yeah, I plan to doc deprecate it later.

@sindresorhus sindresorhus merged commit 23a8da7 into sindresorhus:main May 7, 2025
1 check passed
@Maschina Maschina deleted the removeHandlerPerShortcut branch May 7, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants