News for hackers. Stuff that matters.
Re:Show HN: Open-source Counter-Strike-like game by solcloud on Tuesday October 22, 2024 @02:56PM (#41917469)
thank you, yes like you said all client-side dependencies are "bundled" inside repository, for reading client code start.js is good starting point (https://github.com/solcloud/Counter-Strike/blob/master/www/a...), for server side starting point is server.php (https://github.com/solcloud/Counter-Strike/blob/master/cli/s...)
Re:Show HN: Open-source Counter-Strike-like game by maxloh on Wednesday October 23, 2024 @12:38AM (#41921873)
What is the reason behind wrapping code inside an IIFE (Immediately Invoked Function Expression)?

JavaScript modules are scoped, so nothing can be accessed outside unless explicitly exported.

FYI, you don't even need an IIFE. ES modules are block-scoped by default.

  // Instead of,
  let foo
  (function() {
    const bar = 1
    foo = bar
  })()
  // `bar` is out of scope here

  // You can just,
  let foo
  {
    const bar = 1
    foo = bar
  }
  // `bar` is out of scope here too
Re:Show HN: Open-source Counter-Strike-like game by solcloud on Wednesday October 23, 2024 @04:19AM (#41922959)
I guess history reasons