jam/test/test-later.js

18 lines
402 B
JavaScript
Raw Normal View History

2024-08-27 00:16:16 +02:00
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()