.removeListener()

Removes a Grow event listener that was previously set using the on() method.

Once .removeListener() is called, the associated callback will no longer be executed when the Grow event occurs.


Syntax

window.growMe.removeListener(event, callback)

Parameters

Name Type Description
event string required

Must be one of the supported Grow event values:
- loaded
- authStatusChanged
- isBookmarkedChanged
- dataLoaded

For more information about these events, see the .on() method.
callback function required

The name of the callback previously set.

Return Value(s)

  • No return values.

Example(s)

The following example creates a listener on the Grow loaded event that logs a message to the console. Later on in the code, the listener is removed:

// Create a callback that logs a message to the console.
const cb = () => { 
  console.log("Loaded!");
}

// Create a listener on the 'loaded' event that executes the callback.
window.growMe.on("loaded", cb);

// Sometime later in the code, remove the listener.
window.growMe.removeListener("loaded", cb);