EventHandler

Namespace: TSUI.Events
Extends: None
Implements: IEventHandler
Exported: Yes
JSDoc status: Complete

Associated source files:

Description

Fundamental implementation of an EventHandler. All EventHandlers should inherit from this class.
Note: An event handler can be attached to multiple events (provided it is unaffected by being attached to that event e.g. not destroyed after one event fires).
Note: See ClickEventHandler for sample derived class.

Constructor

constructor(public Callback: (args: IEventArgs) => void , public Context: any);
Creates a new EventHandler.
  • Callback : The function to call when the event handler is invoked.
  • Context : The context to use when calling the Callback function (sets the value of "this" in the callback function).
Note: Should be overridden in derived classes to more specifically type 'args' argument of Callback.

Public Methods

Invoke(args: IEventArgs);
Invokes the event handler's callback with correct context and passes in the arguments.
Note: Should be overridden in derived classes to more specifically type eventArgs argument.

Public Properties

Callback: (args: IEventArgs) => void
The function to call when the event handler is invoked.
Context: any
The context to use when calling the Callback function (sets the value of "this" in the callback function).

Last edited Aug 4, 2013 at 12:46 AM by EdwardNutting, version 4

Comments

No comments yet.