Event

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

Associated source files:

Description

Fundamental implementation of an Event. All Events should inherit from this class.
Note: See ClickEvent for sample derived class.
Note: See List for sample usage.

Public Methods

Attach(handler: IEventHandler): void;
Attaches a an event handler to this event to be called when the event is fired.
  • handler : The event handler to attach.
Note: An event handler can be attached to more than one event.
Note: Should be overridden in derived classes to more specifically type handler argument.
Detach(handler: IEventHandler): void;
Detaches a an event handler from this event. Does nothing if the event handler has not already been attached.
  • handler : The event handler to detach.
Note: Should be overridden in derived classes to more specifically type handler argument.
Invoke(args: IEventArgs);
Invokes (fires) this event with the given event args. Synchronously calls Invoke on each EventHandler in order of attachment, first-to-last.
Note: Should be overridden in derived classes to more specifically type args argument.
IsAttached(handler: IEventHandler): bool;
  • Returns : Whether the specified event handler is attached to this event or not.
  • handler : The event handler to check.
Note: Should be overridden in derived classes to more specifically type handler argument.

Public Properties

Handlers: IEventHandler[]
Private property - do not use externally. Should be overridden in derived classes simply to set the correct EventHandler type.
OnHandlerAttached: () > void
Called when a new event handler is attached - can only be set to one method - if overriding, ensure full implementation as seen in this class.
OnHandlerAttachedContext: any
The context object to use when calling OnHandlerAttached (sets the value of "this" in the called function).
OnHandlerDettached: () > void
Called when a new event handler is attached - can only be set to one method - if overriding, ensure full implementation as seen in this class.
OnHandlerDettachedContext: any
The context object to use when calling OnHandlerDettached (sets the value of "this" in the called function).

Last edited Aug 3, 2013 at 11:43 PM by EdwardNutting, version 3

Comments

No comments yet.