Skip to content

Instantly share code, notes, and snippets.

@shergin
Created October 12, 2009 10:45
Show Gist options
  • Save shergin/208324 to your computer and use it in GitHub Desktop.
Save shergin/208324 to your computer and use it in GitHub Desktop.
mailChecker = {
address: '[email protected]',
constructor: function() {
this.checkMail();
// method 1: use closure
var context = this;
function check() { context.checkMail(); }
// end of method 1
// method 2: use Function object
function check() { check.context.checkMail(); }
check.context = this;
// end of method 2
this.interval = setInterval(check, 1000 * 60 * 5);
},
checkMail: function() {
// use property 'this.address'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment