A target for events. Events may be sent to this target from any thread by calling the dispatch method. Implement this interface in order to support receiving events from other threads.
Gecko 1.6
Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Method overview

void dispatch(in nsIRunnable event, in unsigned long flags);
boolean isOnCurrentThread();
void postEvent(in PLEventPtr aEvent); Native code only! Obsolete since Gecko 1.9


Dispatch flags

Constant Value Description
DISPATCH_NORMAL 0 This flag specifies the default mode of event dispatch, whereby the event is simply queued for later processing. When this flag is specified, dispatch() returns immediately after the event is queued.

This flag specifies the synchronous mode of event dispatch, in which the dispatch() method does not return until the event has been processed.

Note: Passing this flag to dispatch may have the side-effect of causing other events on the current thread to be processed while waiting for the given event to be processed.



Dispatches an event to this event target. This function may be called from any thread, and it may be called re-entrantly.

void dispatch(
  in nsIRunnable event,
  in unsigned long flags
The event to dispatch.
The dispatch flags modifying the event.
Exceptions thrown
Indicates that the thread is shutting down and has finished processing events, so this event would never run and has not been dispatched.
Indicates that event is null.


Check to see if this event target is associated with the current thread.

boolean isOnCurrentThread();


Return value

Returns true if events dispatched to this event target will run on the current thread (that is, the thread calling this method). If events dispatched to this target will be processed on another thread, returns false.

Native code only!


Obsolete since Gecko 1.9 (Firefox 3)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Method for posting an asynchronous event to the event target. If this method succeeds, then the event will be dispatched on the target thread.

void postEvent(
  in PLEventPtr aEvent
The event to dispatched.

Document Tags and Contributors

Contributors to this page: Sheppy, trevorh, JorisW
Last updated by: Sheppy,