diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 39a9754..f7e57d9 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -41,13 +41,13 @@ this.type = CONST.RENDERER_TYPE.WEBGL; - this._boundUpdateTexture = this.updateTexture.bind(this); - this._boundDestroyTexture = this.destroyTexture.bind(this); - this._boundContextLost = this.handleContextLost.bind(this); - this._boundContextRestored = this.handleContextRestored.bind(this); + this.updateTexture = this.updateTexture.bind(this); + this.destroyTexture = this.destroyTexture.bind(this); + this.handleContextLost = this.handleContextLost.bind(this); + this.handleContextRestored = this.handleContextRestored.bind(this); - this.view.addEventListener('webglcontextlost', this._boundContextLost, false); - this.view.addEventListener('webglcontextrestored', this._boundContextRestored, false); + this.view.addEventListener('webglcontextlost', this.handleContextLost, false); + this.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); /** * The options passed in to create a new webgl context. @@ -287,8 +287,8 @@ if (!texture._glTextures[gl.id]) { texture._glTextures[gl.id] = gl.createTexture(); - texture.on('update', this._boundUpdateTexture); - texture.on('dispose', this._boundDestroyTexture); + texture.on('update', this.updateTexture); + texture.on('dispose', this.destroyTexture); } @@ -377,8 +377,8 @@ this.destroyPlugins(); // remove listeners - this.view.removeEventListener('webglcontextlost', this._boundContextLost); - this.view.removeEventListener('webglcontextrestored', this._boundContextRestored); + this.view.removeEventListener('webglcontextlost', this.handleContextLost); + this.view.removeEventListener('webglcontextrestored', this.handleContextRestored); // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); @@ -396,8 +396,8 @@ this.filterManager = null; this.blendModeManager = null; - this._boundContextLost = null; - this._boundContextRestored = null; + this.handleContextLost = null; + this.handleContextRestored = null; this._contextOptions = null; diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 39a9754..f7e57d9 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -41,13 +41,13 @@ this.type = CONST.RENDERER_TYPE.WEBGL; - this._boundUpdateTexture = this.updateTexture.bind(this); - this._boundDestroyTexture = this.destroyTexture.bind(this); - this._boundContextLost = this.handleContextLost.bind(this); - this._boundContextRestored = this.handleContextRestored.bind(this); + this.updateTexture = this.updateTexture.bind(this); + this.destroyTexture = this.destroyTexture.bind(this); + this.handleContextLost = this.handleContextLost.bind(this); + this.handleContextRestored = this.handleContextRestored.bind(this); - this.view.addEventListener('webglcontextlost', this._boundContextLost, false); - this.view.addEventListener('webglcontextrestored', this._boundContextRestored, false); + this.view.addEventListener('webglcontextlost', this.handleContextLost, false); + this.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); /** * The options passed in to create a new webgl context. @@ -287,8 +287,8 @@ if (!texture._glTextures[gl.id]) { texture._glTextures[gl.id] = gl.createTexture(); - texture.on('update', this._boundUpdateTexture); - texture.on('dispose', this._boundDestroyTexture); + texture.on('update', this.updateTexture); + texture.on('dispose', this.destroyTexture); } @@ -377,8 +377,8 @@ this.destroyPlugins(); // remove listeners - this.view.removeEventListener('webglcontextlost', this._boundContextLost); - this.view.removeEventListener('webglcontextrestored', this._boundContextRestored); + this.view.removeEventListener('webglcontextlost', this.handleContextLost); + this.view.removeEventListener('webglcontextrestored', this.handleContextRestored); // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); @@ -396,8 +396,8 @@ this.filterManager = null; this.blendModeManager = null; - this._boundContextLost = null; - this._boundContextRestored = null; + this.handleContextLost = null; + this.handleContextRestored = null; this._contextOptions = null; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index fb658ec..74f3889 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -31,13 +31,13 @@ this.autoUpdate = false; - this._boundOnUpdate = this._onUpdate.bind(this); - this._boundOnCanPlay = this._onCanPlay.bind(this); + this._onUpdate = this._onUpdate.bind(this); + this._onCanPlay = this._onCanPlay.bind(this); if (!source.complete) { - source.addEventListener('canplay', this._boundOnCanPlay); - source.addEventListener('canplaythrough', this._boundOnCanPlay); + source.addEventListener('canplay', this._onCanPlay); + source.addEventListener('canplaythrough', this._onCanPlay); // started playing.. source.addEventListener('play', this._onPlayStart.bind(this)); @@ -55,7 +55,7 @@ { if (this.autoUpdate) { - window.requestAnimationFrame(this._boundOnUpdate); + window.requestAnimationFrame(this._onUpdate); this.update(); } }; @@ -64,7 +64,7 @@ { if (!this.autoUpdate) { - window.requestAnimationFrame(this._boundOnUpdate); + window.requestAnimationFrame(this._onUpdate); this.autoUpdate = true; } }; @@ -80,8 +80,8 @@ if (this.source) { - this.source.removeEventListener('canplay', this._boundOnCanPlay); - this.source.removeEventListener('canplaythrough', this._boundOnCanPlay); + this.source.removeEventListener('canplay', this._onCanPlay); + this.source.removeEventListener('canplaythrough', this._onCanPlay); this.width = this.source.videoWidth; this.height = this.source.videoHeight;