-
-
Save amythee/d656576221800e712d0f79dfae75595f 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 { getCommunityTopic, EventSubscriberRepository, SubscriptionLevels } from '@amityco/js-sdk'; | |
const communityModel = {}; | |
const topic = getCommunityTopic(communityModel, SubscriptionLevels.POST); | |
// Subscription has an optional error callback parameter that can be used. | |
EventSubscriberRepository.subscribe(topic, err => { | |
if (err) { | |
// handle subscription error here | |
console.log('Error', err); | |
} | |
// handle subscription success here. | |
console.log('Subscription successful'); | |
}); | |
// Unsubscribe | |
EventSubscriberRepository.unsubscribe(topic); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment