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

No public API to check if custom event is registered; duplicate registration throws error and crashes application #72

Open
rjgotten opened this issue Feb 8, 2021 · 0 comments

Comments

@rjgotten
Copy link

rjgotten commented Feb 8, 2021

There is currently no public API to check if a particular custom event is already registered.

Any component that needs a particular custom event, including predefined ones such as inserted needs to take care to register them beforehand. Given that this whole API is global, a collision where two components have to use and register the same event is likely.

Currently, attempting to do so results in a thrown exception which halts the entire application.

Suggestion:

  1. Forward the has method from the underlying EventRegistry as a hasEvent method so developers can check for prior registration.
  2. Use can-log/dev/dev to log a warning regarding duplicated registration during dev mode builds, mirroring can-component behavior.
@rjgotten rjgotten changed the title No public API to check if custom event is registered No public API to check if custom event is registered; duplicate registration throws error and crashes application Feb 8, 2021
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

1 participant