The module pattern is described by most people as:
var module = (function() {
// private fields
var a, b, c;
// private functions
function myFunction() {}
// public data (where you expose to outside)
return {
publicFunc: function() {}
};
})();
But the above code creates a single instance of the module. Does it really have to be a singleton?
Is the code below still a module pattern?
function module() {
// same code
return {
publicFunc: function() {}
};
}