I would like to know how can I create a module and manually create more instances of that module without impacting the global scope.
Right now I have something similar to this piece of code:
var myModule = (function(){
...
})();
myModule is at this point in the global scope of my app.
What can I do to encapsulate this somewhere and call a new instance of it anytime I need one?
I am looking for something similar with Require.js or Angular.
var coolModule = ["wow", "neat", "module"];module.exports = coolModule;Then in another file:var coolModule = require("coolModule");Is that what you have in mind?requireI want to be a new instance ofcoolModule