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);