代码改变世界

一位印度小伙跟我说的js模式,其实,我懂!切。

2011-10-19 22:18  前端小鬼  阅读(248)  评论(0)    收藏  举报
(function(){

var mySpace=function(){

return new PrivateSpace();

}
var PrivateSpace=function(){

};
PrivateSpace.prototype={

init:function(){

console.log('init this:', this);

return this;

},
ajax:function(){

console.log('make ajax calls here');

return this;

},
cache:function(){

console.log('cache selectors here');

return this;

}

}
window.my$=mySpace();
})();