JSFiddle - React, Tailwind, and code Playground
JavaScript
// 4. execute tower.init latter read from bellow (1)
tower = {
init: function () {
console.log('horee im here now, finaly after a day code');
alert("worked"); // added this alert for simplicity.
}
}
// 3. app object
app = {
publish: function (what, data) {
window[data.nextModule].init();
}
}
// 2. then call this funct
var new1 = function () {
return app.publish('subscriber', {
nextModule: 'tower'
});
}
// 1. execute this first
new1();