I am changing JavaScript function in JSNI but eventlistener not call properly. Here is the code:
private native void alert1()/*-{
$doc.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
$wnd.alert("1111111");
}, true);
}-*/;
Javascript function is :
document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
window.alert("2222222222");
}, true);
any suggestions?
onModuleLoad
is (almost) guaranteed to run after DOMContentLoaded
, so: