Closed
Description
IMO, If properties
are inputs to a Custom element, Custom Events
are outputs. Currently properties
are first class citizens, they can be annotated via decorators and type checked.
CustomEvents
are defined like this:
// my-custom-element.ts
let event = new CustomEvent('my-event', {
detail: {
message: 'Something important happened'
}
});
this.dispath(event);
You listen on the parent like this
<my-custom-element @my-event=${this.handleMyEvent}></my-custom-element>
When listening for these events on the parent(s), the only source of API knowledge is documentation if it all exists else you are left to reading internal implementation. The types on detail
key are not enforced. It will be great if lit-element
could implement maybe decorators to annotate custom events emitted by an Element.
Metadata
Metadata
Assignees
Labels
No labels