How do I use custom events in TypeScript?
In jQuery I do this:
$("#btnShowExplorer").click(function () {
$.event.trigger("showexplorerpf");
});
and somewhere else I ‘listen’ for that event
// bind to the special custom event
$('#idExplorerWindow').bind("showexplorerpf", function () {
// do stuff...
});
I am now moving my code to TypeScript – I have a ref to the jQuery type def file but the $.event.trigger is not recognized..
Thanks
You may need to extend the jQuery interface. My example has it all in one file, but it doesn’t have to be in the same file – just one you reference.