Home Reference Source
public class | source

EventDispatcher

Extends:

react~React.Component → EventDispatcher

A base class for all objects that are capable of dispatching events.

Constructor Summary

Public Constructor
public

constructor(props: *, arg1: *, arg2: *)

Member Summary

Public Members
public

[prop]: *

public
public

A list of event listeners for this event dispatcher object.

public

typeCache: {}

Method Summary

Public Methods
public

addEventListener(context: *, type: *, listener: *)

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.

public
public

dispatchEvent(event: *): boolean

Dispatches an event into the event flow.

public
public

getStyle(prop: *): *

Gets the value of the prop property on this object

public

Returns true if an event listener exists

public

Returns true if the class name to check is in the list of class names defined for this class.

public

kill()

Removes all event listeners

public

killArray(arr: *)

Given an array of event dispatchers, calls the kill method on each of them.

public

removeEventListener(type: *, listener: *)

Removes a listener from the EventDispatcher object.

public

setStyle(prop: *, val: *)

Sets the value of the prop property on this object

Public Constructors

public constructor(props: *, arg1: *, arg2: *) source

Params:

NameTypeAttributeDescription
props *
arg1 *
arg2 *

Public Members

public [prop]: * source

public dead: boolean source

public eventListeners: Array source

A list of event listeners for this event dispatcher object.

public typeCache: {} source

Public Methods

public addEventListener(context: *, type: *, listener: *) source

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. If you no longer need an event listener, remove it by calling removeEventListener(), or memory problems could result. Event listeners are not automatically removed from memory because the garbage collector does not remove the listener as long as the dispatching object exists.

Params:

NameTypeAttributeDescription
context *

The "this" property in the event listener function will be set to the value of this parameter.

type *

The type of event.

listener *

The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing

public constructed() source

public dispatchEvent(event: *): boolean source

Dispatches an event into the event flow. The event target is the EventDispatcher object upon which the dispatchEvent() method is called.

Params:

NameTypeAttributeDescription
event *

The Event object that is dispatched into the event flow.

Return:

boolean

public getClassNames(): string[] source

Return:

string[]

public getStyle(prop: *): * source

Gets the value of the prop property on this object

Params:

NameTypeAttributeDescription
prop *

Return:

*

public hasEventListener(type: *): Boolean source

Returns true if an event listener exists

Params:

NameTypeAttributeDescription
type *

The type of event.

Return:

Boolean

public implementsOrExtends(name: *): Boolean source

Returns true if the class name to check is in the list of class names defined for this class.

Params:

NameTypeAttributeDescription
name *

Name of the class to check

Return:

Boolean

public kill() source

Removes all event listeners

public killArray(arr: *) source

Given an array of event dispatchers, calls the kill method on each of them.

Params:

NameTypeAttributeDescription
arr *

The list of event dispatchers to kill.

public removeEventListener(type: *, listener: *) source

Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.

Params:

NameTypeAttributeDescription
type *

The type of event.

listener *

The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing

public setStyle(prop: *, val: *) source

Sets the value of the prop property on this object

Params:

NameTypeAttributeDescription
prop *
val *