When using widget in a web application (SPA, SSR, SSG, etc.), the loading or unloading of the widget may not be performed correctly.
To address this issue, a set of data and methods are provided, injected into the browser's window object, allowing the developer to interact with the widget.
How to proceed :
In the window object, window.joinStories.widgets[alias] is available with the following elements:
loaded→ shows the widget's current stateload→ method to load the widgetunload→ method to unload the widget
→ Call window.joinStories.widgets[alias].unload() to remove a widget.
→ Call window.joinStories.widgets[alias].load() to display a widget.
→ Call window.joinStories.widgets[alias].load(true) to force the widget to re-display.