aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/root-helpers/utils.ts
blob: af94ed6cac82f0d3039e7609a2482e663417fae1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                               
                            
                                   



                               
        
                  
      
 
function copyToClipboard (text: string) {
  const el = document.createElement('textarea')
  el.value = text
  el.setAttribute('readonly', '')
  el.style.position = 'absolute'
  el.style.left = '-9999px'
  document.body.appendChild(el)
  el.select()
  document.execCommand('copy')
  document.body.removeChild(el)
}

function wait (ms: number) {
  return new Promise<void>(res => {
    setTimeout(() => res(), ms)
  })
}

export {
  copyToClipboard,
  wait
}