Skip to main content

How to load/unload widget with Web App

Updated over a year ago

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 state

  • load โ†’ method to load the widget

  • unload โ†’ 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.

Did this answer your question?