Freigeben über


removeEventListener method

Removes an event handler that the IEventTarget::addEventListener method registered.

 

Syntax

HRESULT retVal = object.removeEventListener(type, listener, useCapture);

Parameters

type [in]

Type: BSTR

The event IDOMEvent::type that the event handler is registered for.

listener [in]

Type: IDispatch

The event handler function to remove.

useCapture [in]

Type: VARIANT_BOOL

A VARIANT_BOOL value that specifies the event phase to remove the event handler from:

VARIANT_TRUE (true)

Remove the capturing phase event handler.

VARIANT_FALSE (false)

Remove the bubbling phase event handler.

Return value

Type: HRESULT

This method can return one of these values.

Return code Description
S_OK

The operation completed successfully.

E_FAIL

The operation failed.

E_INVALIDARG

One or more arguments are invalid.

 

Standards information

Remarks

If you register multiple identical event handlers for the same event type, the duplicate event handlers are discarded. You can remove only the first instance.

If the arguments for IEventTarget::removeEventListener do not identify a registered event handler, the call to IEventTarget::removeEventListener has no effect.

See also

IEventTarget::addEventListener