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

Support binding a key multiple times #10

Open
mathieucaroff opened this issue Sep 25, 2019 · 1 comment
Open

Support binding a key multiple times #10

mathieucaroff opened this issue Sep 25, 2019 · 1 comment

Comments

@mathieucaroff
Copy link

mathieucaroff commented Sep 25, 2019

Current behavior

Currently, when a key is bound multiple times, the last binding operation overrides the previous ones.

Expected behavior

When a key or mouse event is bound multiple times, InputBot dispatches the event to all callback functions, in the order in which they were registered.

Note: this would be a breaking change.

After thinking about it, I found the current API, with KeydbKey:unbind(&self), would make a rather coarse API, requiring to unregister all callbacks at once.

Alternative

Provide a new interface which handles dispatch.

@obv-mikhail
Copy link
Owner

@mathieucaroff I agree that we would probably want to have a different unbind method. Maybe something like KeydbKey:unbind(&self, fn) where fn is the function bound to the event originally.

How would the alternative with an interface for handling dispatch look like?

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

No branches or pull requests

2 participants