diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 1a8afa2..99123db 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -50,14 +50,6 @@ this.handleContextLost = this.handleContextLost.bind(this); this.handleContextRestored = this.handleContextRestored.bind(this); - this._updateTextureBound = function(e){ - this.updateTexture(e.target); - }.bind(this); - - this._destroyTextureBound = function(e){ - this.destroyTexture(e.target); - }.bind(this); - this.view.addEventListener('webglcontextlost', this.handleContextLost, false); this.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); @@ -365,8 +357,8 @@ if (!texture._glTextures[gl.id]) { texture._glTextures[gl.id] = gl.createTexture(); - texture.on('update', this._updateTextureBound); - texture.on('dispose', this._destroyTextureBound); + texture.on('update', this.updateTexture, this); + texture.on('dispose', this.destroyTexture, this); } diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 1a8afa2..99123db 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -50,14 +50,6 @@ this.handleContextLost = this.handleContextLost.bind(this); this.handleContextRestored = this.handleContextRestored.bind(this); - this._updateTextureBound = function(e){ - this.updateTexture(e.target); - }.bind(this); - - this._destroyTextureBound = function(e){ - this.destroyTexture(e.target); - }.bind(this); - this.view.addEventListener('webglcontextlost', this.handleContextLost, false); this.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); @@ -365,8 +357,8 @@ if (!texture._glTextures[gl.id]) { texture._glTextures[gl.id] = gl.createTexture(); - texture.on('update', this._updateTextureBound); - texture.on('dispose', this._destroyTextureBound); + texture.on('update', this.updateTexture, this); + texture.on('dispose', this.destroyTexture, this); } diff --git a/src/core/renderers/webgl/managers/WebGLManager.js b/src/core/renderers/webgl/managers/WebGLManager.js index c39ad26..a1c9d72 100644 --- a/src/core/renderers/webgl/managers/WebGLManager.js +++ b/src/core/renderers/webgl/managers/WebGLManager.js @@ -12,12 +12,7 @@ */ this.renderer = renderer; - var self = this; - this.renderer.on('context', this._onContextChangeFn = function () { - - self.onContextChange(); - - }); + this.renderer.on('context', this.onContextChange, this); } WebGLManager.prototype.constructor = WebGLManager; @@ -38,7 +33,7 @@ */ WebGLManager.prototype.destroy = function () { - this.renderer.off('context', this._onContextChangeFn); + this.renderer.off('context', this.onContextChange); this.renderer = null; }; diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index 1a8afa2..99123db 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -50,14 +50,6 @@ this.handleContextLost = this.handleContextLost.bind(this); this.handleContextRestored = this.handleContextRestored.bind(this); - this._updateTextureBound = function(e){ - this.updateTexture(e.target); - }.bind(this); - - this._destroyTextureBound = function(e){ - this.destroyTexture(e.target); - }.bind(this); - this.view.addEventListener('webglcontextlost', this.handleContextLost, false); this.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); @@ -365,8 +357,8 @@ if (!texture._glTextures[gl.id]) { texture._glTextures[gl.id] = gl.createTexture(); - texture.on('update', this._updateTextureBound); - texture.on('dispose', this._destroyTextureBound); + texture.on('update', this.updateTexture, this); + texture.on('dispose', this.destroyTexture, this); } diff --git a/src/core/renderers/webgl/managers/WebGLManager.js b/src/core/renderers/webgl/managers/WebGLManager.js index c39ad26..a1c9d72 100644 --- a/src/core/renderers/webgl/managers/WebGLManager.js +++ b/src/core/renderers/webgl/managers/WebGLManager.js @@ -12,12 +12,7 @@ */ this.renderer = renderer; - var self = this; - this.renderer.on('context', this._onContextChangeFn = function () { - - self.onContextChange(); - - }); + this.renderer.on('context', this.onContextChange, this); } WebGLManager.prototype.constructor = WebGLManager; @@ -38,7 +33,7 @@ */ WebGLManager.prototype.destroy = function () { - this.renderer.off('context', this._onContextChangeFn); + this.renderer.off('context', this.onContextChange); this.renderer = null; }; diff --git a/src/extras/MovieClip.js b/src/extras/MovieClip.js index fccdf7c..3a8586b 100644 --- a/src/extras/MovieClip.js +++ b/src/extras/MovieClip.js @@ -73,13 +73,6 @@ * @readonly */ this.playing = false; - - /** - * private cache of the bound function - * - * @member {function} - */ - this._updateBound = this.update.bind(this); } // constructor @@ -138,7 +131,7 @@ } this.playing = false; - Ticker.off('tick', this._updateBound); + Ticker.off('tick', this.update); }; /** @@ -153,7 +146,7 @@ } this.playing = true; - Ticker.on('tick', this._updateBound); + Ticker.on('tick', this.update, this); }; /**