Created
October 12, 2009 10:45
-
-
Save shergin/208324 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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