init
Initializing your app or widget
To initialize the communication with the host simply call the init method on the handler object, await the result and from this point, the widget communication is ready for use.
You should receive a unique widget uid when the widget is set up in the host. The value should be identical to the value held by the host, or the initialization will fail. When using this code snippet, replace [YOUR_WIDGET_UID] with the widget uid you received from the host.
import messageHandler from '@vcita/intandem-app-com';
const hostWindow = window.parent;
const widgetWindow = window;
const widgetUid = '[YOUR_WIDGET_UID]';
let initialized = false;
await messageHandler.init(hostWindow, widgetWindow, widgetUid).then(() => {
// The widget is ready to communicate with the host
initialized = true;
}).catch((error) => {
// In case there is an error during initialization
console.log(error);
});
Updated 5 days ago