3 ms·
JavaScript 1.7 already supports a very similar module pattern. For example: myModule: { // don't do anything if myModule is already included if
by Sephr 16y ago
JavaScript 1.7 already supports a very similar module pattern. For example:
myModule: {
// don't do anything if myModule is already included
if (myModule) break myModule;
let this_is_private = ...;
var myModule = ...;
// myModule is public and won't pollute the
// global NS if it isn't included globally.
}