Skip to content

Commit ad382f5

Browse files
author
Ryan A. Johnson
committed
feat(HXElement): make all emitted events cancelable
* Allows any emitted event to be cancelable. * Return status from `$emit()` * If `true`, the event was not canceled. * If `false`, the event was canceled by an event listener.
1 parent 0c8691b commit ad382f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/helix-ui/elements/HXElement.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ export class HXElement extends HTMLElement {
8888

8989
$emit (evtName, details) {
9090
let evt = new CustomEvent(evtName, {
91+
cancelable: true,
9192
bubbles: true,
9293
detail: details,
9394
});
94-
this.dispatchEvent(evt);
95+
return this.dispatchEvent(evt);
9596
}//$emit
9697

9798
$relayEvent (oldEvent) {

0 commit comments

Comments
 (0)