Skip to content

Standardize Event handling/destroying and semantics #50

@DennisSmolek

Description

@DennisSmolek

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    planningissues related to planning for the library

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions