API Reference

removeEventListener

The removeEventListener command is used to remove an existing event listener.

Command

__gpp('removeEventListener', myFunction, listenerId);
//removes event listener with eventId 1000

function remove_fn(data, success) {
  console.log("Event listener removed:" + data);
  console.log("Event listened successfully executed:" + success);
}

...

<button onclick="__gpp('removeEventListener', remove_fn, 1000)">Remove event listener</button>

Response

In addition to any custom code you might implement when your function executes, a successful action will return true for the success parameter.

The callback will return false as the argument for the data parameter if the listener can not be removed (e.g. the CMP cannot find a registered listener corresponding to the listenerId). A value of false will be returned as the argument to the success parameter if Sourcepoint fails to process this command.