Harald Pehl
02/05/2021, 5:30 PMclass TreeItemSelectEvent<T>(val treeItem: TreeItem<T>) : Event("treeitemselect")
fun select(treeItem: TreeItem<T>) {
element.dispatchEvent(TreeItemSelectEvent(treeItem))
}
When I try to create and dispatch the event, I get the following error:
TypeError: Failed to construct 'Event': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
Using CustomEvent
instead of Event
doesn't help. What am I missing?Robert Jaros
02/05/2021, 5:37 PMRobert Jaros
02/05/2021, 5:41 PMHarald Pehl
02/05/2021, 5:41 PMCustomEvent
instead of my own event type which extends from CustomEvent
?Robert Jaros
02/05/2021, 5:47 PMRobert Jaros
02/05/2021, 5:50 PMRobert Jaros
02/05/2021, 5:53 PMEvent
- the compiler generates Event.call(this, ...);
in JS and doesn't use new