]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/root-helpers/utils.ts
Translated using Weblate (Dutch)
[github/Chocobozzz/PeerTube.git] / client / src / root-helpers / utils.ts
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
13 function wait (ms: number) {
14 return new Promise<void>(res => {
15 setTimeout(() => res(), ms)
16 })
17 }
18
19 export {
20 copyToClipboard,
21 wait
22 }