Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Created December 31, 2011 02:23
Show Gist options
  • Select an option

  • Save hughfdjackson/1542552 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/1542552 to your computer and use it in GitHub Desktop.
function MyClass()
{
var self = this
// warning message if mouse moves more than halfway across the screen
this.check_mouse = function() {
if (mouse_x >= SCREEN_WIDTH / 2)
{
alert("What are you doing?!");
}
};
setInterval(function(){
self.check_mouse()
}, 5000);
}
var MyInstance = new MyClass();
// Will I need to instead use setInterval("MyInstance.check_mouse()", 5000) if I want to call that instance's check_mouse() each time?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment