Skip to content

Instantly share code, notes, and snippets.

@RStankov
Created October 27, 2010 16:10
Show Gist options
  • Save RStankov/649352 to your computer and use it in GitHub Desktop.
Save RStankov/649352 to your computer and use it in GitHub Desktop.
Function.RETURN_SELF = function(){
return this;
}
var Widget = (function(UI){
var Widget = function(){
// initialize
}
Widget.prototype = {
// methods - move / destroy
};
var instance;
function createWidget(e, element){
instance = new Widget(element);
instance.move(e);
this.move = moveWidget;
this.hide = hideWidget;
return this;
}
function moveWidget(e){
instance.move(e);
return this;
}
function hideWidget(){
instance.destroy();
instance = null
this.move = createWidget;
this.hide = Function.RETURN_SELF;
return this;
}
return {
show: createWidget,
move: createWidget,
hide: Function.RETURN_SELF
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment