Skip to content

Instantly share code, notes, and snippets.

@primalmotion
Created October 20, 2010 18:45
Show Gist options
  • Select an option

  • Save primalmotion/637040 to your computer and use it in GitHub Desktop.

Select an option

Save primalmotion/637040 to your computer and use it in GitHub Desktop.
function Controller(element)
{
this.element = element;
this.foo = "bar";
this.element.addEventListener('click', this.mouseClick);
}
Controller.prototype.mouseClick = function(event)
{
alert(this.foo); // obviously doesn't work because this is 'element'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment