-
Notifications
You must be signed in to change notification settings - Fork 24
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
Make the library event driven with function callbacks #7
Comments
Hi, |
Hi, |
Hi, Another thing is the amount of events and the type of events. For example ENCODER_INCREMENT and ENCODER_DECREMENT could be one event type, for example onChange. Now you have to specify two eventhandlers for practically the same - the encoder 'wiper' changed. This could be something like onChange( obj, direction ), for example negative (steps) when turned left and positive (steps) when turned right. Also the assignment of events could be more user friendly and less prone to errors (for example using the wrong constants, there is also no range check in the
So you can do, to assign an event handler:
This naming convention is more clear, nicer, easier and also very similar to other languages and you don't need to call a function to assign a handler. To remove the handler, simply assign NULL. |
Thank you a lot for the suggestion!
Yeah i have noticed that huge mistake, i will fix. |
Hello, |
Because it is now a more advanced product and you can use more than one, make it event driven. Hopefully you understand the idea and why this would be nice. It makes it easier to handle more objects at once and avoids a if then else mess (structorize the code).
for example:
The text was updated successfully, but these errors were encountered: