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

Standardize Event handling/destroying and semantics #50

Open
DennisSmolek opened this issue Apr 10, 2024 · 0 comments
Open

Standardize Event handling/destroying and semantics #50

DennisSmolek opened this issue Apr 10, 2024 · 0 comments
Labels
planning issues related to planning for the library

Comments

@DennisSmolek
Copy link
Collaborator

DennisSmolek commented Apr 10, 2024

When creating event handling I often had a class like: addTypeofEventHandler and a removeTypeofEventHandler and handlers may have labels/names to them that had to be passed.

More common in JS , (and later in development) the "remove" function is returned as part of the creation:

const removeListener = physicsSystem.addLoopListener(whateverFn);
removeListener();

This is a cleaner and more expected method and I think the way to go.

Another issue is the usage of "on" as in "onXYZ" vs "addXYZHandler" this is mostly a semantic issue.

Lastly, some functions, like "action" functions on the characterController class, are filter functions. The controller fires MANY actions, and it would be annoying to add handlers for every type.
Instead it uses the pattern onAction('actionLabel', handler) with the return being the remover.

@DennisSmolek DennisSmolek added the planning issues related to planning for the library label Apr 10, 2024
@DennisSmolek DennisSmolek added this to the 1.0 Feature Parity milestone Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
planning issues related to planning for the library
Projects
None yet
Development

No branches or pull requests

1 participant