Skip to content
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

Merged
merged 49 commits into from
Oct 28, 2023
Merged

feat(sdk): Implement Chitchatter SDK #183

merged 49 commits into from
Oct 28, 2023

Conversation

jeremyckahn
Copy link
Owner

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):

<script src="https://chitchatter.im/sdk.js"></script>

<chat-room />

sdk/sdk.ts Outdated
window.removeEventListener('message', handleMessageReceived)
}

window.addEventListener('message', handleMessageReceived)

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.

Copy link
Owner Author

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!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Followup fix in b4fa41a.

@jeremyckahn jeremyckahn merged commit f6a3e30 into develop Oct 28, 2023
2 checks passed
@jeremyckahn jeremyckahn deleted the feature/sdk branch October 28, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants