Skip to content

Instantly share code, notes, and snippets.

@ashic
Created September 23, 2011 09:54
Show Gist options
  • Save ashic/1237057 to your computer and use it in GitHub Desktop.
Save ashic/1237057 to your computer and use it in GitHub Desktop.
object
if(!window.MYNAMESPACE) window.MYNAMESPACE = {};
window.MYNAMESPACE.proxy = function(){
var that, someSharedVariable;
that = {};
someSharedVariable = 10;
that.doSomething = function(){
callJqueryOrSomething();
//use someSharedVariable;
};
that.doSomethingElse = function(a){
callJqueryOrSomething();
//use someSharedVariable, a;
};
return that;
};
//usage
var caller = MYNAMESPACE.proxy();
caller.doSomething();
caller.doSomethingElse(20);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment