Hacker News new | ask | show | jobs
by jakiestfu 4478 days ago
new function(window){}(this) is kinda weird to me. Sorry that's nothing valuable to add to your code.
1 comments

Correct me if I'm wrong, but what this does is: 1) allows the code to be run in an environment where 'window' is not the global object (perhaps for testing), and 2) in a browser, gives the caller the option to isolate the module code so it's not allowed to touch 'window'.