Strongly Typed Events

Events – styled after the way .Net implements events. With each event you’ll get a sender and an argument object. If you use typescript, you can implement them using generics. npm install ste-events --save

Simple events – basically the same thing, with only an argument. npm install ste-simple-events --save

Signals – for when no data is needed, just the firing of the event is enough: npm install ste-signals --save

Turns out that I needed an even smaller type of event: the signal. It is an event that has no data; it just fires. The Strongly Typed Events project started with the IEvent event that was styled after .Net. Then the ISimpleEvent was added in 0.2.0, for scenarios when no sender is necessary. Now I’ve added the ISignal to version 0.3.0.

A while ago I started a GitHub project for Strongly Typed Events in TypeScript. I’ve uploaded the second version (0.2) with support for ISimpleEvent and I changed the way you can expose the dispatcher as an event. The code is 100% backwards compatible with version 0.1 – you might need to update some references.

Need to add named event support to your class? Implement the IEventHandling interface or extend from the abstract EventHandlingBase class. In this tutorial I explore how you can give your class named events.

In this tutorial I explore how an event list can be used to support scenarios with classes with a multitude of events. There is a way to decrease the number of private backing variables using an EventList object.

In a previous tutorial I explained how events can be implemented as properties on a class using Strongly Typed Events for TypeScript. Let’s explore how these work on interfaces. Interfaces work a little different, because they don’t have getters and setters on them (at least nog in TypeScript 1.8). Let’s explore how these work on interfaces.

As a C# programming I have a lot of interest in the TypeScript project. Lately I’ve been playing around with it to look what it can do. I found myself in need of some event handling, so I decided to build something that looks like the event handling .Net gives you.