1 function copyToClipboard (text: string) {
2 const el = document.createElement('textarea')
4 el.setAttribute('readonly', '')
5 el.style.position = 'absolute'
6 el.style.left = '-9999px'
7 document.body.appendChild(el)
9 document.execCommand('copy')
10 document.body.removeChild(el)
13 function wait (ms: number) {
14 return new Promise<void>(res => {
15 setTimeout(() => res(), ms)