Why the code inside the app.init() function not executed?
(function () {
console.log('loaded here');
function ready(callbackFunction){
if (document.readyState != 'loading')
callbackFunction(event)
else
document.addEventListener("DOMContentLoaded", callbackFunction)
}
var app = function (options) {
var app = this,
version = 1.00;
app.init = function () {
console.log('not loaded here');
console.log(window);
}
app.init();
};
ready(event => {
console.log('dom is loaded');
window.myApp = function (opt) { return new app(opt); };
});
})();