Skip to main content

unlisten

unlisten(messageName, *bundleName, handlerFunc) → {boolean}

Removes a listener for a message.

Messages are namespaced by bundle. To remove a listener to a message in another bundle's namespace, provide it as the second argument.

Parameters

NameTypeAttributesDefaultDescription
messageNamestringThe name of the message.
bundleNamestring<optional>Current bundleThe bundle namespace to in which to listen for this message
handlerFuncfunctionA reference to a handler function added as a listener to this message via listenFor.

Example

nodecg.unlisten('printMessage', someFunctionName);

Removing a listener from a message in another bundle's namespace:

nodecg.unlisten('printMessage', 'another-bundle', someFunctionName);