JSFiddle - React, Tailwind, and code Playground
HTML
<button>Trigger window load</button>
<i>Have a look at your console.</i>
JavaScript
Event.observe(window, 'load', function() {
// Various snippets of code
console.log('onLoad');
});
Event.triggerWindow = function(eventName){
var oEvent = document.createEvent('HTMLEvents');
oEvent.initEvent(eventName, true, true);
window.dispatchEvent(oEvent);
}
$$('button').invoke('observe', 'click', Event.triggerWindow.bind(this, 'load'));