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:
- Forward the
has method from the underlying EventRegistry as a hasEvent method so developers can check for prior registration.
- Use
can-log/dev/dev to log a warning regarding duplicated registration during dev mode builds, mirroring can-component behavior.