Skip to content

Instantly share code, notes, and snippets.

@amythee
Last active April 3, 2022 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amythee/d656576221800e712d0f79dfae75595f to your computer and use it in GitHub Desktop.
Save amythee/d656576221800e712d0f79dfae75595f to your computer and use it in GitHub Desktop.
ASC Sample Code
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