Created
April 9, 2013 21:30
-
-
Save noelrocha/5349581 to your computer and use it in GitHub Desktop.
Abstract Poller in coffee script
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
class Poller | |
constructor: (name) -> | |
console.log "[#{name}]" | |
@name = name | |
@failed = 0 | |
@interval = 5000 | |
@run = true | |
timeoutID = null | |
init: () -> | |
#console.log "[#{@name}] init" | |
timeoutID = setTimeout(@process, @interval) | |
stop: () -> | |
console.log "[#{@name}] stop" | |
run = false | |
window.clearTimeout(timeoutID) | |
process: () -> | |
console.log "[Poller.process] should be implemented" | |
errorHandler: () -> | |
console.log "[Poller.errorHandler] should be implemented" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment