Skip to content

Instantly share code, notes, and snippets.

@jinlong
Created September 9, 2013 08:52
Show Gist options
  • Save jinlong/6493130 to your computer and use it in GitHub Desktop.
Save jinlong/6493130 to your computer and use it in GitHub Desktop.
Revealing Module Pattern(揭示模块模式):暴露的全局变量和局部变量,保持语法一致。
var module = function(){
var current = null;
var labels = {
'home':'home',
'articles':'articles',
'contact':'contact'
};
var init = function(){
};
var show = function(){
current = 1;
};
var hide = function(){
show();
}
return{init:init, show:show, current:current}
}();
module.init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment