@shop25/notifications-iframe
v1.0.5
Published
```bash npm i @shop25/notifications-iframe ```
Downloads
17
Readme
Install
npm i @shop25/notifications-iframe
Usage
import { NotificationClient } from '@shop25/notifications-iframe'
const mainWidgetTarget = document.querySelector("body") as HTMLElement;
const popupsMoutPoint = document.querySelector("#app") as HTMLElement;
const client = new NotificationClient({
host: "https://widget-notifications.s25.work",
project: "vodnik",
});
const mainWidget = client.createMainWidget();
const popupWidget = client.createPopupWidget();
async function init() {
await mainWidget.mount(mainWidgetTarget);
await popupWidget.mount(popupsMoutPoint);
popupWidget.onChangeTotalCount((totalCount: number) => {
console.log({ totalCount });
});
# if need
mainWidget.destroy();
popupWidget.destroy();
}
init();