Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods for removing handlers for specific Names #194

Closed
wants to merge 1 commit into from

Conversation

joshnies
Copy link

Adds the following methods for removing only the handlers for specific Names:

/**
Remove all handlers for one or more names. Includes both "key down" and "key up" handlers.
*/
public static func removeHandlers(for names: [Name]) {}

/**
Remove all "key down" handlers for one or more names.
*/
public static func removeKeyDownHandlers(for names: [Name]) {}

/**
Remove all "key up" handlers for one or more names.
*/
public static func removeKeyUpHandlers(for names: [Name]) {}

NOTE: I also made legacyKeyDownHandlers and legacyKeyUpHandlers internal for testing purposes.

@sindresorhus
Copy link
Owner

I'm not sure it makes sense to add these methods as onKeyDown/onKeyUp are legacy and will be deprecated in the future. The recommended API is .events() which does not need this.

@joshnies joshnies closed this Dec 2, 2024
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