What if you need to have multiple instances? Example two armies carry different weapons.
Remove () in the ARMORY module in the previous Article.
var ARMORY = (function(){
// Private
var weaponList = [ * List of weapon object * ];
var removeWeapon = function(...){};
var replaceWeapon = function(...){};
// Public
return{
makeArmorRequest: function(...){}
}
});
Now you can create multiple instances:var army1 = new ARMORY();
var army2 = new ARMORY();
No comments:
Post a Comment