### Events

Wijmo defines an Event Class that is similar to the one in .NET. This allows any class to define events. A class can subscribe to an event using the addHandler method of the event, or unsubscribe using the removeHandler method.

Wijmo event handlers take two parameters: sender and args. The first is the object that raised the event, and the second is an object that contains the event parameters.

Classes that define events follow the .NET pattern: for every event there is an onEventName method that raises the event. This pattern allows derived classes to override the onEventName method and handle the event before or after the base class raises it. Derived classes can suppress the event by not calling the base class implementation.

For example, the TypeScript code below overrides the onValueChanged event for a control to perform some processing before and after the valueChanged event fires:

    // override base class
    onValueChanged(e: EventArgs) {
      // execute some code before the event fires
      console.log('about to fire valueChanged');
      // optionally, call base class to fire the event
      super.onValueChanged(e);
      // execute some code after the event fires
      console.log('valueChanged event just fired');
    }