Skip to content

Instantly share code, notes, and snippets.

@niceaji
Last active December 13, 2015 23:29
Show Gist options
  • Save niceaji/4992246 to your computer and use it in GitHub Desktop.
Save niceaji/4992246 to your computer and use it in GitHub Desktop.
var modulejs=function(name, source){
var names = name.split(".")
, len = names.length
, context = this
, root = ''
, p='';
if(!source){
return;
}
// console.log(name);
for(var i=0; i<len; i++){
p = names[i];
if(i === 0){
root = context[p];
}
if(i < len-1){
if(typeof context[p] === "undefined"){
context[p] = {};
}
}
else {
context[p] = source(root, jQuery); //의존모듈 넣어주기
return;
}
context = context[p];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment