Visit Mozilla.org

nsIDOMEventListener

From MDC

[edit] Summary

nsIDOMEventListener is the XPCOM interface matching the W3C's DOM level 2 EventListener interface. It is used to register event callbacks.

nsIDOMEventListener is defined in dom/public/idl/events/nsIDOMEventListener.idl. It is scriptable and has been frozen since Mozilla 0.9.7.

#include "nsIDOMEventListener.h"

[scriptable, function, uuid=(df31c120-ded6-11d1-bd85-00805f8ae3f4)]
interface nsIDOMEventListener : nsISupports { ... };

[edit] Methods

handleEvent(in nsIDOMEvent event);
The handleEvent method is invoked to notify the listener of an event.

[edit] Remarks

As the interface is marked with the [function] flag, all JavaScript Function objects automatically implement this interface. Calling the handleEvent method on such an implementation automatically invokes the function.