constructor(handlersChanged?: Function): Event
Initializes a new instance of an Event.
Optional callback invoked when handlers are added or removed from this Event.
addHandler(handler: IEventHandler, self?: any): void
Adds a handler to this event.
Function invoked when the event is raised.
Object that defines the event handler (accessible as 'this' from the handler code).
getHandler(index?: number): IEventHandler
Gets a handler to this event.
Desired handle index number, this is usually zero.
raise(sender: any, args?: EventArgs): void
Raises this event, causing all associated handlers to be invoked.
Source object.
Event parameters.
removeAllHandlers(): void
Removes all handlers associated with this event.
removeHandler(handler: IEventHandler, self?: any): void
Removes a handler from this event.
Function invoked when the event is raised.
Object that owns the event handler (accessible as 'this' from the handler code).
Represents an event.
Wijmo events are similar to .NET events. Any class may define events by declaring them as fields. Any class may subscribe to events using the event's addHandler method and 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 where for every event there is an on[EVENTNAME] method that raises the event. This pattern allows derived classes to override the on[EVENTNAME] method and handle the event before and/or after the base class raises the event. Derived classes may even 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: