Jump to content

Search the Community

Showing results for tags 'General JS'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. In actionscript you would get an error if you tried to call a method of an object which did not exist and I am guessing JS is the same. function destroy(): void{ this._apple.destroy() //error, you cannot call destroy() because this._apple is null or undefined}So what I end up doing was this which worked for a decade: function destroy(): void{ if (this._apple != null) { this._apple.removeEventsBlah... this._apple.destroy(); this._apple = null; } }But this feels primitive. When you have like 12 class members, and you got to check if they are null. Apart from that, I read this is not accurate for JS? I should use typeof? So if typeof variable === "undefined" Basically, how do you correctly destroy objects? Is it merely enough in JS just to null it.... this._apple = null. I am not sure how stuff works without a virtual machine doing garbage collection where it is important to remove all listeners/references while I am struggling to figure out what is null in relation to undefined.
×
×
  • Create New...