Skip to content

Restrict usage of Events in favor of CustomEvent #9

@pmdartus

Description

@pmdartus

When using events, a component has the option of choosing between the Event and CustomEvent interfaces. Our strong recommendation is to go with the CustomEvent interface because this will provide a more consistent experience. The framework may need to patch properties and methods of events to prevent component internals from leaking or to normalize implementations between browsers, and using CustomEvent guarantees that your component is covered.

I think it's ok to restrict usage of new Event() out of the gate unless we know of any use cases where users have to do that instead of new CustomEvent().


Edit: This issue has been migrated from the eslint-plugin repo. This restriction can be enforced by configuring the standard no-restricted-globals rule instead of creating a brand new rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    USER STORYkind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions