-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sdk): Implement Chitchatter SDK #183
Conversation
sdk/sdk.ts
Outdated
window.removeEventListener('message', handleMessageReceived) | ||
} | ||
|
||
window.addEventListener('message', handleMessageReceived) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're adding an event listener to the window, you may want to add a disconnectedCallback
that removes the event listener and clears the timer if the component gets removed from the DOM before a message is received.
Otherwise, there's a possibility that the timer or the event handler will retain the component in memory, even if it has been removed from the DOM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch. This is fixed in 75cfca6!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followup fix in b4fa41a.
This PR implements a Chitchatter SDK for embedding Chitchatter instances into web apps with configuration options beyond the standard
<iframe />
method. It can be used like so (once merged and deployed):