Skip to main content

detachEvent

Unsubscribes from the specified event.

Syntax​

expression.detachEvent(eventName);

expression - A variable that represents a Api class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
eventNameRequiredstringThe event name.

Returns​

This method doesn't return any data.

Example​

Unsubscribe from the hyperlink click event in a presentation.

// Detaching events removes previously registered listeners to stop event handling.

// Remove the listener from the asc_onHyperlinkClick event using Api.detachEvent().

Api.detachEvent("asc_onHyperlinkClick");