I've been trying to find an elegant way of dealing with events in TypeScript/AngularJS recently. If you're not farmiliar with Angular, that's ok, this is a pretty common pattern.
Here I have a controller that registers an event listener:
function MyController($rootScope) {
$rootScope.$on('event1', () => {
console.log('event 1 occured');
});