TargetNode.prototype.destroy = function()

in seriously.js [3980:4022]


		TargetNode.prototype.destroy = function () {
			var i,
				targetList;

			//source
			if (this.source && this.source.removeTarget) {
				this.source.removeTarget(this);
			}

			if (allTargets) {
				targetList = allTargets.get(this.target);
				delete targetList[seriously.id];
				if (!Object.keys(targetList).length) {
					allTargets.delete(this.target);
				}
			}

			if (this.plugin && this.plugin.destroy) {
				this.plugin.destroy.call(this);
			}

			delete this.source;
			delete this.target;
			delete this.pub;
			delete this.uniforms;
			delete this.pixels;
			delete this.auto;

			//remove self from master list of targets
			i = targets.indexOf(this);
			if (i >= 0) {
				targets.splice(i, 1);
			}

			Node.prototype.destroy.call(this);

			//clear out context so we can start over
			if (this === primaryTarget) {
				glCanvas.removeEventListener('webglcontextrestored', restoreContext, false);
				destroyContext();
				primaryTarget = null;
			}
		};