Adi – 17-33 May 30

I have one question lets say I am using revealing module pattern in JS and if some methods are public and I attach that module to window object then I can access that public method of that specific module in another JS file is that correct? But lets say we have 2 separate files each of them are ESModules generated through webpack then can I access public method of one file in another JS file?? As we have generated both files using webpack module bundler they will not be accessed from any other file is this correct understanding?
S
ScriptyChris689d ago
An ESM module or "old school" one (created typically by some IIFE) doesn't attach any variables to the global scope by default (unless you explicitly do so or are in non-strict mode, which allows implicit global variables). So if you create any variable in such module, then it will not be accessible outside that module (including global scope)
UU
Unknown User688d ago