Skip to content

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

@rjgotten

Description

@rjgotten

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions