in seriously.js [2924:3001]
EffectNode.prototype.destroy = function () {
var i, key, item, hook = this.hook;
//let effect destroy itself
if (this.effect.destroy && typeof this.effect.destroy === 'function') {
this.effect.destroy.call(this);
}
delete this.effect;
//shader
if (commonShaders[hook]) {
commonShaders[hook].count--;
if (!commonShaders[hook].count) {
delete commonShaders[hook];
}
}
if (this.shader && this.shader.destroy && this.shader !== baseShader && !commonShaders[hook]) {
this.shader.destroy();
}
delete this.shader;
//stop watching any input elements
for (key in this.inputElements) {
if (this.inputElements.hasOwnProperty(key)) {
item = this.inputElements[key];
item.element.removeEventListener('change', item.listener, true);
item.element.removeEventListener('input', item.listener, true);
}
}
//sources
for (key in this.sources) {
if (this.sources.hasOwnProperty(key)) {
item = this.sources[key];
if (item && item.removeTarget) {
item.removeTarget(this);
}
delete this.sources[key];
}
}
//targets
while (this.targets.length) {
item = this.targets.pop();
if (item && item.removeSource) {
item.removeSource(this);
}
}
for (key in this) {
if (this.hasOwnProperty(key) && key !== 'id') {
delete this[key];
}
}
//remove any aliases
for (key in aliases) {
if (aliases.hasOwnProperty(key)) {
item = aliases[key];
if (item.node === this) {
seriously.removeAlias(key);
}
}
}
//remove self from master list of effects
i = effects.indexOf(this);
if (i >= 0) {
effects.splice(i, 1);
}
i = allEffectsByHook[hook].indexOf(this);
if (i >= 0) {
allEffectsByHook[hook].splice(i, 1);
}
Node.prototype.destroy.call(this);
};