mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:52:45 +00:00 
			
		
		
		
	 5c6125c92b
			
		
	
	
		5c6125c92b
		
	
	
	
	
		
			
			This test proves the ability of TransformStream to execute caller supplied code in the start callback, and have access to TransformStreamDefaultController.
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			559 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			559 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <script src="../include.js"></script>
 | |
| <script>
 | |
|     test(() => {
 | |
|         const {readable} = new TransformStream({
 | |
|             start(controller) {
 | |
|                 println("In start");
 | |
|                 controller.enqueue("Hello, world!");
 | |
|             }
 | |
|         });
 | |
|         const reader = readable.getReader();
 | |
|         reader.read().then(function processText({done, value}) {
 | |
|             println(`Done: ${done}`);
 | |
|             if (done)
 | |
|                 return;
 | |
| 
 | |
|             println(value);
 | |
|             reader.read().then(processText);
 | |
|         });
 | |
|     });
 | |
| </script>
 |