Skip to content

Instantly share code, notes, and snippets.

@ibolmo
Created January 24, 2012 17:34
Show Gist options
  • Select an option

  • Save ibolmo/1671377 to your computer and use it in GitHub Desktop.

Select an option

Save ibolmo/1671377 to your computer and use it in GitHub Desktop.
var Animal = new Class({
bounds: {},
initialize: function(element){
if (element) this.attach(element);
},
attach: function(element){
if (this.element) this.detach();
this.bounds.onClick = this.onClick.bind(this);
this.element = $(element);
this.element.addEvents(this.bounds);
},
detach: function(){
this.element.removeEvents(this.bounds);
this.element = null;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment