Javascript examples for DOM Event:dispatchEvent
Create new Event and fire it with window.dispatchEvent()
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w . j a v a 2 s . c o m*/ function resizeHandler(e) { console.log(e.type + ' triggered.'); } window.addEventListener('resize', resizeHandler); var resizeEvent = new Event('resize'); window.dispatchEvent(resizeEvent); } </script> </head> <body> </body> </html>