JSFiddle - React, Tailwind, and code Playground

by robaldred

JavaScript

Test = function() {
    
};

Test.prototype.sendEvent = function() {
    document.write('triggering event');
    $(this).trigger('myevent');
};

    
var test = new Test();
$(test).on('myevent',function() {
    document.write('caught event');
});
test.sendEvent();