JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
    <button id="btn">Test clipboard write</button>
</body>
<script type="module">

document.getElementById('btn').onclick = async () => {
	let dat = new Uint8Array(20);
    
	navigator.clipboard.writeText('test 1').then(function() {
       alert('Copy to clipboard successed 1');
   }, function() {
       alert('Copy to clipboard failed 1');
   });
   
   let test = await crypto.subtle.digest('SHA-256', dat);
   
   navigator.clipboard.writeText('test 2').then(function() {
       alert('Copy to clipboard successed 2');
   }, function() {
       alert('Copy to clipboard failed 2');
   });
};

</script>
</html>