Hi, i am adding EmbedEvent listners to

Hi, i am adding EmbedEvent listners to SearchEmebed when creating the component and i want to destroy them while navigating away, (but keep the component rendered and just hide it from view). to remove the listener i am running off.(...) but this is not working. any idea why it is not working
6 Replies
shikharTS
shikharTS3mo ago
It should work, have you made sure this .off method is actually being called. Also just check if the syntax is correct or not https://developers.thoughtspot.com/docs/Class_LiveboardEmbed#_off. The component rendering should not affect this..
LiveboardEmbed
Embed a ThoughtSpot Liveboard or visualization. When rendered it already waits for the authentication to complete, so you need not wait for AuthStatus.SUCCESS.
Mope10
Mope10OP3mo ago
hi, let me know if i am doing something wrong in the above video
Justin Mathew
Justin Mathew3mo ago
@Mope10 the usage is a bit wrong try something like this
const messageHandler = () => {...someCode}
embed.on(Event, messageHandler)
embed.off(Event, messageHandler)
const messageHandler = () => {...someCode}
embed.on(Event, messageHandler)
embed.off(Event, messageHandler)
Mope10
Mope10OP3mo ago
@Justin Mathew should i also add messageHandler in Off? according to docs it looks like this is a errorHandler function
Justin Mathew
Justin Mathew3mo ago
@Mope10 we have a lot of customisations available in our product , its up to your usecase we support turning off any function
Mope10
Mope10OP3mo ago
let me test it out on playground and back to you, if adding messageHandler fixes my issue it solved the issue, sending massageHandler successfully remove events

Did you find this page helpful?