3 ms·
new function(window){}(this) is kinda weird to me. Sorry that's nothing valuable to add to your code.
by jakiestfu 13y ago
new function(window){}(this) is kinda weird to me. Sorry that's nothing valuable to add to your code.
- hamburglar 13y agoCorrect 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'.