ndt7-js icon indicating copy to clipboard operation
ndt7-js copied to clipboard

main.js modifies the global scope in Node.js

Open RA80533 opened this issue 3 years ago • 0 comments

https://github.com/m-lab/ndt7-js/blob/1150c12d1fb1b28a1cea6eff64c4b2c18cc8288a/src/ndt7.js#L10-L11

In Node.js, modules imported via require are included in a manner such that variable declarations are kept separate from the importing code; unfortunately, the same is not true for property assignment.

https://github.com/m-lab/ndt7-js/blob/1150c12d1fb1b28a1cea6eff64c4b2c18cc8288a/src/ndt7.js#L15-L25

It's not expected for any of the three modules to be directly accessible in the global scope. Two of the three modules represent browser-specific APIs (WebSocket and Fetch) while the other isn't but is available through a built-in module of its own (see #28).

RA80533 avatar Mar 28 '21 08:03 RA80533