Skip to content

Commit

Permalink
remove uncecessary off's
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksims committed Dec 3, 2024
1 parent 8ea7a1b commit 5822a7f
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 29 deletions.
4 changes: 0 additions & 4 deletions src/framework/components/element/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2560,14 +2560,10 @@ class ElementComponent extends Component {
this.system.app.elementInput.addElement(this);
}

this._evtLayersChanged?.off();
this._evtLayersChanged = scene.on('set:layers', this.onLayersChanged, this);

if (layers) {
this._evtLayerAdded?.off();
this._evtLayerAdded = layers.on('add', this.onLayerAdded, this);

this._evtLayerRemoved?.off();
this._evtLayerRemoved = layers.on('remove', this.onLayerRemoved, this);
}

Expand Down
1 change: 0 additions & 1 deletion src/framework/components/element/image-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,6 @@ class ImageElement {

// Hook up event handlers on sprite asset
_bindSprite(sprite) {
this._evtSetMeshes?.off();
this._evtSetMeshes = sprite.on('set:meshes', this._onSpriteMeshesChange, this);
sprite.on('set:pixelsPerUnit', this._onSpritePpuChange, this);
sprite.on('set:atlas', this._onAtlasTextureChange, this);
Expand Down
4 changes: 0 additions & 4 deletions src/framework/components/gsplat/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,10 @@ class GSplatComponent extends Component {
const scene = this.system.app.scene;
const layers = scene.layers;

this._evtLayersChanged?.off();
this._evtLayersChanged = scene.on('set:layers', this.onLayersChanged, this);

if (layers) {
this._evtLayerAdded?.off();
this._evtLayerAdded = layers.on('add', this.onLayerAdded, this);

this._evtLayerRemoved?.off();
this._evtLayerRemoved = layers.on('remove', this.onLayerRemoved, this);
}

Expand Down
4 changes: 0 additions & 4 deletions src/framework/components/light/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1247,14 +1247,10 @@ class LightComponent extends Component {

this.light.enabled = true;

this._evtLayersChanged?.off();
this._evtLayersChanged = scene.on('set:layers', this.onLayersChanged, this);

if (layers) {
this._evtLayerAdded?.off();
this._evtLayerAdded = layers.on('add', this.onLayerAdded, this);

this._evtLayerRemoved?.off();
this._evtLayerRemoved = layers.on('remove', this.onLayerRemoved, this);
}

Expand Down
4 changes: 0 additions & 4 deletions src/framework/components/model/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,14 +953,10 @@ class ModelComponent extends Component {
const scene = app.scene;
const layers = scene?.layers;

this._evtLayersChanged?.off();
this._evtLayersChanged = scene.on('set:layers', this.onLayersChanged, this);

if (layers) {
this._evtLayerAdded?.off();
this._evtLayerAdded = layers.on('add', this.onLayerAdded, this);

this._evtLayerRemoved?.off();
this._evtLayerRemoved = layers.on('remove', this.onLayerRemoved, this);
}

Expand Down
4 changes: 0 additions & 4 deletions src/framework/components/particle-system/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1974,14 +1974,10 @@ class ParticleSystemComponent extends Component {
this.addMeshInstanceToLayers();
}

this._evtLayersChanged?.off();
this._evtLayersChanged = scene.on('set:layers', this.onLayersChanged, this);

if (layers) {
this._evtLayerAdded?.off();
this._evtLayerAdded = layers.on('add', this.onLayerAdded, this);

this._evtLayerRemoved?.off();
this._evtLayerRemoved = layers.on('remove', this.onLayerRemoved, this);
}

Expand Down
4 changes: 0 additions & 4 deletions src/framework/components/render/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,14 +818,10 @@ class RenderComponent extends Component {

this._cloneSkinInstances();

this._evtLayersChanged?.off();
this._evtLayersChanged = scene.on('set:layers', this.onLayersChanged, this);

if (layers) {
this._evtLayerAdded?.off();
this._evtLayerAdded = layers.on('add', this.onLayerAdded, this);

this._evtLayerRemoved?.off();
this._evtLayerRemoved = layers.on('remove', this.onLayerRemoved, this);
}

Expand Down
4 changes: 0 additions & 4 deletions src/framework/components/sprite/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,14 +677,10 @@ class SpriteComponent extends Component {
const scene = app.scene;
const layers = scene.layers;

this._evtLayersChanged?.off();
this._evtLayersChanged = scene.on('set:layers', this._onLayersChanged, this);

if (layers) {
this._evtLayerAdded?.off();
this._evtLayerAdded = layers.on('add', this._onLayerAdded, this);

this._evtLayerRemoved?.off();
this._evtLayerRemoved = layers.on('remove', this._onLayerRemoved, this);
}

Expand Down

0 comments on commit 5822a7f

Please sign in to comment.