]>
Commit | Line | Data |
---|---|---|
afff310e RK |
1 | function copyToClipboard (text: string) { |
2 | const el = document.createElement('textarea') | |
3 | el.value = text | |
4 | el.setAttribute('readonly', '') | |
5 | el.style.position = 'absolute' | |
6 | el.style.left = '-9999px' | |
7 | document.body.appendChild(el) | |
8 | el.select() | |
9 | document.execCommand('copy') | |
10 | document.body.removeChild(el) | |
11 | } | |
12 | ||
210856a7 | 13 | function wait (ms: number) { |
72aa835e | 14 | return new Promise<void>(res => { |
210856a7 C |
15 | setTimeout(() => res(), ms) |
16 | }) | |
17 | } | |
18 | ||
4504f09f | 19 | export { |
afff310e | 20 | copyToClipboard, |
210856a7 | 21 | wait |
4504f09f | 22 | } |