Kustomer.removeListener()
Removes a callback function that was added through addListener()
First, initialize chat fully
Kustomer Chat must finish initializing fully with
Kustomer.start()
before you can execute any additional Web SDK methods.Tip: Call other methods inside the callback of
Kustomer.start()
to ensure Kustomer Chat always completes initialization before the code tries to run other methods.To learn more, see Troubleshooting: Kustomer method calls won't execute.
Examples
We're provided some examples of how you can call Kustomer.removeListener()
:
const onOpenHandler = function () {
console.log('Widget was opened');
}
Kustomer.addListener('onOpen', onOpenHandler);
Kustomer.removeListener('onOpen', onOpenHandler);
Syntax
Kustomer.removeListener(event, function)
Is that really you?
When you use
removeListener
, make sure that the function you pass in is the same reference as the one you used when you ranaddListener
or it won't be removed properly.
Updated almost 4 years ago