You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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:
has
method from the underlyingEventRegistry
as ahasEvent
method so developers can check for prior registration.can-log/dev/dev
to log a warning regarding duplicated registration during dev mode builds, mirroring can-component behavior.The text was updated successfully, but these errors were encountered: