The documentation mentions that React is not needed, but there aren’t any examples of subscribing to context events without using React, so I’m hoping you can point me in the right direction.
Is there a simple way to use the sdk without React for sidebar plugins? Preferably, a way to include a script directly on a page (without a build step) and then subscribe to events.
Something similar to this would be great:
<script type="text/javascript" src="https://dl.frontapp.com/libs/frontjs.min.js"></script>
<script>
Front.contextUpdates.subscribe(context => {
switch(context.type) {
case 'noConversation':
console.log('No conversation selected');
break;
case 'singleConversation':
console.log('Selected conversation:', context.conversation);
break;
case 'multiConversations':
console.log('Multiple conversations selected', context.conversations);
break;
default:
console.error(`Unsupported context type: ${context.type}`);
break;
}
});
</script>
However the Front object that is created by that included script doesn’t have a contextUpdates property.