Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
		
							parent
							
								
									bf52ebc1c5
								
							
						
					
					
						commit
						a367c55854
					
				
							
								
								
									
										17
									
								
								test/test-later.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/test-later.js
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
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()
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user