@esotericsoftware/spine-phaser-v3 4.2.85 → 4.2.87

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.
@@ -11532,19 +11532,24 @@ var spine = (() => {
11532
11532
  let canvas = canvasOrContext;
11533
11533
  this.gl = canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig);
11534
11534
  this.canvas = canvas;
11535
- canvas.addEventListener("webglcontextlost", (e) => {
11536
- let event = e;
11537
- if (e) e.preventDefault();
11538
- });
11539
- canvas.addEventListener("webglcontextrestored", (e) => {
11540
- for (let i = 0, n = this.restorables.length; i < n; i++)
11541
- this.restorables[i].restore();
11542
- });
11535
+ canvas.addEventListener("webglcontextlost", this.contextLostHandler);
11536
+ canvas.addEventListener("webglcontextrestored", this.contextRestoredHandler);
11543
11537
  } else {
11544
11538
  this.gl = canvasOrContext;
11545
11539
  this.canvas = this.gl.canvas;
11546
11540
  }
11547
11541
  }
11542
+ contextLostHandler(e) {
11543
+ if (e) e.preventDefault();
11544
+ }
11545
+ contextRestoredHandler(e) {
11546
+ for (let i = 0, n = this.restorables.length; i < n; i++)
11547
+ this.restorables[i].restore();
11548
+ }
11549
+ dispose() {
11550
+ this.canvas.removeEventListener("webglcontextlost", this.contextLostHandler);
11551
+ this.canvas.removeEventListener("webglcontextrestored", this.contextRestoredHandler);
11552
+ }
11548
11553
  addRestorable(restorable) {
11549
11554
  this.restorables.push(restorable);
11550
11555
  }