JSFiddle - React, Tailwind, and code Playground
JavaScript
window.App = window.App || {};
window.App.SomeObject = {
myFunction: function (event) {
console.log('EVENT FIRED!');
console.log(event);
},
init: function () {
$(document).bind('myEvent', function (event) {
window.App.SomeObject.myFunction(event);
});
}
}
$(function () {
window.App.SomeObject.init();
});
$(document).trigger('myEvent');