MCPcopy Create free account
hub / github.com/melonjs/melonJS / destroy

Method destroy

packages/melonjs/src/renderable/sprite.js:830–847  ·  view source on GitHub ↗

* Destroy function * @ignore

()

Source from the content-addressed store, hash-verified

828 * @ignore
829 */
830 destroy() {
831 // release the engine's pooled `current.offset`
832 this._frameAnim.destroy();
833 vector2dPool.release(this.offset);
834 this.offset = undefined;
835 if (this.isVideo) {
836 this.removeStatePauseListener();
837 this.image.onended = undefined;
838 this.image.pause();
839 this.image.currentTime = 0;
840 }
841 this.image = undefined;
842 // drop the normal-map reference too — same precedent as `image`,
843 // avoids holding a (possibly large) paired image alive after the
844 // sprite is gone
845 this._normalMap = null;
846 super.destroy();
847 }
848}

Callers

nothing calls this directly

Calls 3

destroyMethod · 0.65
releaseMethod · 0.65
pauseMethod · 0.45

Tested by

no test coverage detected