]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/root-helpers/utils.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / root-helpers / utils.ts
CommitLineData
afff310e
RK
1function 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 13function wait (ms: number) {
72aa835e 14 return new Promise<void>(res => {
210856a7
C
15 setTimeout(() => res(), ms)
16 })
17}
18
4504f09f 19export {
afff310e 20 copyToClipboard,
210856a7 21 wait
4504f09f 22}