mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:42:45 +00:00 
			
		
		
		
	 4b94b0b561
			
		
	
	
		4b94b0b561
		
	
	
	
	
		
			
			https://w3c.github.io/clipboard-apis/ This implements enough for navigator.clipboard.writeText(String).
		
			
				
	
	
		
			26 lines
		
	
	
	
		
			733 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			733 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <button id="button"></button>
 | |
| <script src="include.js"></script>
 | |
| <script type="text/javascript">
 | |
|     function writeText(onComplete) {
 | |
|         navigator.clipboard.writeText("Well hello friends :^)").then(
 | |
|             () => {
 | |
|                 println("Success");
 | |
|                 onComplete();
 | |
|             },
 | |
|             () => {
 | |
|                 println("Failure");
 | |
|                 onComplete();
 | |
|             }
 | |
|         );
 | |
|     }
 | |
| 
 | |
|     asyncTest((done) => {
 | |
|         writeText(() => {
 | |
|             const button = document.getElementById("button");
 | |
|             internals.dispatchUserActivatedEvent(button, new Event("mousedown"));
 | |
|             button.dispatchEvent(new Event("click"));
 | |
| 
 | |
|             writeText(done);
 | |
|         });
 | |
|     });
 | |
| </script>
 |