-
-
Save amythee/f03ed67be2640b28b6d07d916ed50b9d to your computer and use it in GitHub Desktop.
ASC Sample Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PostRepository, getPostTopic, SubscriptionLevels } from '@amityco/js-sdk'; | |
let postModel = {}; | |
const livePost = PostRepository.postForId('abc'); | |
livePost.on('dataUpdated', model => { | |
postModel = model; | |
// Post topic to subscribe to all events of that post model only | |
// Example events: post edited, reactions added | |
const postTopic = getPostTopic(postModel, SubscriptionLevels.POST); | |
console.log('Post topic', postTopic); | |
// Post topic to subscribe to all comment events of that post model | |
// Example events: comment created, comment deleted, comment updated | |
const postCommentsTopic = getPostTopic(postModel, SubscriptionLevels.COMMENT); | |
console.log('Post Comments Topic', postCommentsTopic); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment