How to use 'object destruction in javascript' in JavaScript

Every line of 'object destruction in javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
140doDestroy(obj: any): void {
141 if (this.definition.destroyMethod && obj[this.definition.destroyMethod]) {
142 obj[this.definition.destroyMethod].call(obj);
143 }
144}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

66public destroyObject(obj:GameObject) {
67 var key = obj.key;
68 if (this._pool[key] == null) {
69 this._pool[key] = [];
70 }
71 this._pool[key].push(obj);
72 obj.onDestroy();
73 var index = this._list.indexOf(obj);
74 if (index != -1) {
75 this._list.splice(index, 1);
76 }
77}

Related snippets