カプセル化原型
by zerippe
JavaScript
if(typeof Package == 'undefined'){
var Package = {};
}
if(typeof Package.Module == 'undefined'){
Package.Module = new function(){
var const_params = {};
this.construct = function(params){
$.extend(const_params, params, {});
};
this.hoge = function(){
alert(const_params.test);
};
};
Package.Module.construct({
test: "default"
});
}
Package.Module.construct({test: "nanndakore"});
Package.Module.hoge();