jam/test/test-later.js

18 lines
402 B
JavaScript

port(DIR.IP('http://localhost:10001'))
// collector task
later(1000, function () {
var tuples = inp(['SURVEY',_],true)||[];
log('Got '+tuples.length+' surveys');
if (tuples.length) {
csv.write('surveys.csv',_,pluck(tuples,1));
}
return true;
});
// test only
later(2000, function () {
out(['SURVEY',{from:'test',answer:'yes'}]);
out(['SURVEY',{from:'test',answer:'no'}]);
})
start()