1// Simple trigger event
2document.querySelector(theElem).dispatchEvent(new Event('mouseover'))
1//Listen for the event
2window.addEventListener("MyEventType", function(evt) {
3 alert(evt.detail);
4}, false);
5
6//Dispatch an event
7var evt = new CustomEvent("MyEventType", {detail: "Any Object Here"});
8window.dispatchEvent(evt);
1const eventDetails = {
2 'id': elemId
3}
4document.dispatchEvent (
5 new CustomEvent('myCustomEvent', {'detail': eventDetails})
6)