pollcatch 2.5.7 → 2.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pc.js +18 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pollcatch",
3
3
  "private": false,
4
- "version": "2.5.7",
4
+ "version": "2.5.8",
5
5
  "type": "module",
6
6
  "main": "pc.js",
7
7
  "module": "pc.js",
package/pc.js CHANGED
@@ -1364,7 +1364,7 @@ class Zo {
1364
1364
  } catch (n) {
1365
1365
  throw g.error("Error loading stats:", n, this.localStats), n;
1366
1366
  } finally {
1367
- this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
1367
+ this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate(), await this.host.updateComplete, this.dispatchInitEvent();
1368
1368
  }
1369
1369
  }
1370
1370
  /**
@@ -1569,6 +1569,23 @@ class Zo {
1569
1569
  });
1570
1570
  o.dispatchEvent(r), g.debug("Dispatched submit event", t);
1571
1571
  }
1572
+ /**
1573
+ * Dispatches an 'init' CustomEvent on the host element
1574
+ * This event fires once after data has loaded and the widget has rendered
1575
+ */
1576
+ dispatchInitEvent() {
1577
+ const t = this.host, o = new CustomEvent("init", {
1578
+ detail: {
1579
+ widgetId: t.widgetId,
1580
+ widgetName: t.name,
1581
+ widgetType: t.type,
1582
+ stats: this.stats
1583
+ },
1584
+ bubbles: !0,
1585
+ composed: !0
1586
+ });
1587
+ t.dispatchEvent(o), g.debug("Dispatched init event");
1588
+ }
1572
1589
  hasLocalStats() {
1573
1590
  var t;
1574
1591
  return ((t = this.localStats) == null ? void 0 : t.count) > 0;