R
Reactiflux

Adi – 17-33 May 30

Adi – 17-33 May 30

AAdi5/30/2022
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?
SScriptyChris5/30/2022
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)
UUUnknown User5/31/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

Adi – 17-33 May 30

Join Server