coer-elements 0.0.96 → 0.0.97

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.
@@ -1272,24 +1272,31 @@ class Screen {
1272
1272
  }
1273
1273
  /** */
1274
1274
  static { this.Resize = new Observable(subscriber => {
1275
- window.addEventListener("load", () => {
1276
- window.dispatchEvent(new Event('resize'));
1277
- });
1278
- window.onresize = () => {
1275
+ const handleResize = () => {
1279
1276
  subscriber.next({
1280
- width: this.WINDOW_WIDTH,
1281
- height: this.WINDOW_HEIGHT,
1282
- breakpoin: this.BREAKPOINT
1277
+ width: window.innerWidth,
1278
+ height: window.innerHeight,
1279
+ breakpoint: this.BREAKPOINT
1283
1280
  });
1284
1281
  };
1282
+ window.addEventListener("resize", handleResize);
1283
+ window.addEventListener("load", handleResize);
1284
+ return () => {
1285
+ window.removeEventListener("resize", handleResize);
1286
+ window.removeEventListener("load", handleResize);
1287
+ };
1285
1288
  }); }
1286
1289
  /** */
1287
1290
  static { this.BackButtonBrowser = new Observable(subscriber => {
1288
- window.addEventListener('popstate', popStateEvent => {
1291
+ const handlePopState = (popStateEvent) => {
1289
1292
  if (popStateEvent.state && popStateEvent.target) {
1290
1293
  subscriber.next(popStateEvent.target.location.href);
1291
1294
  }
1292
- });
1295
+ };
1296
+ window.addEventListener('popstate', handlePopState);
1297
+ return () => {
1298
+ window.removeEventListener('popstate', handlePopState);
1299
+ };
1293
1300
  }); }
1294
1301
  }
1295
1302