Created
June 11, 2014 07:18
-
-
Save davidklassen/c8422467d99683e9daad to your computer and use it in GitHub Desktop.
This file contains hidden or 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
reader = fn (source) { | |
// fetch data from somewhere e.g. http server and emit result | |
this.emit('some data') | |
} | |
parser = fn (data) { | |
// parse and validate data and emit result | |
this.emit(parsedData) | |
} | |
worker = fn { | |
every(10sec, fn { | |
reader.read('http://...') | |
reader.on('data', parser.parse) | |
parser.on('data', println) | |
}) | |
} | |
main = forever worker.work |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment