I had a look at the JavaScript module pattern but it seems it's only use to create singletons. Is it possible to use the same pattern to create more than one instance of the same module? Or should I look at a different pattern?
You can create a pseudo class with javascript. Look here
var Module = (function() {
return { ... };
}());
would create Singleton
var createModule = function() {
return { ... };
}
would create a function that creates the module object
var ModuleInstance = createModule();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.