@syncfusion/ej2-base 22.2.5 → 22.2.10

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.
@@ -7286,6 +7286,7 @@ var Component = /** @__PURE__ @class */ (function (_super) {
7286
7286
  }
7287
7287
  if (this.enablePersistence) {
7288
7288
  this.setPersistData();
7289
+ this.detachUnloadEvent();
7289
7290
  }
7290
7291
  this.localObserver.destroy();
7291
7292
  if (this.refreshing) {
@@ -7347,6 +7348,25 @@ var Component = /** @__PURE__ @class */ (function (_super) {
7347
7348
  return window.localStorage.getItem(eleId);
7348
7349
  }
7349
7350
  };
7351
+ /**
7352
+ * Adding unload event to persist data when enable persistence true
7353
+ */
7354
+ Component.prototype.attachUnloadEvent = function () {
7355
+ this.handleUnload = this.handleUnload.bind(this);
7356
+ window.addEventListener('unload', this.handleUnload);
7357
+ };
7358
+ /**
7359
+ * Handling unload event to persist data when enable persistence true
7360
+ */
7361
+ Component.prototype.handleUnload = function () {
7362
+ this.setPersistData();
7363
+ };
7364
+ /**
7365
+ * Removing unload event to persist data when enable persistence true
7366
+ */
7367
+ Component.prototype.detachUnloadEvent = function () {
7368
+ window.removeEventListener('unload', this.handleUnload);
7369
+ };
7350
7370
  /**
7351
7371
  * Appends the control within the given HTML element
7352
7372
  *
@@ -7369,7 +7389,7 @@ var Component = /** @__PURE__ @class */ (function (_super) {
7369
7389
  }
7370
7390
  if (this.enablePersistence) {
7371
7391
  this.mergePersistData();
7372
- window.addEventListener('unload', this.setPersistData.bind(this));
7392
+ this.attachUnloadEvent();
7373
7393
  }
7374
7394
  var inst = getValue('ej2_instances', this.element);
7375
7395
  if (!inst || inst.indexOf(this) === -1) {