| 88 | } |
| 89 | |
| 90 | async function handleCopyIP(event) |
| 91 | { |
| 92 | // To prevent the default contexmenu from showing up when right-clicking.. |
| 93 | event.preventDefault(); |
| 94 | // Copy the IP to the clipboard. |
| 95 | try |
| 96 | { |
| 97 | await window.navigator.clipboard.writeText(networkData.currentIp) |
| 98 | connectionState.set("IPCOPIED"); |
| 99 | setTimeout(() => { |
| 100 | connectionState.set("CONNECTED"); |
| 101 | }, 2000); |
| 102 | } |
| 103 | catch(msg) |
| 104 | { |
| 105 | console.log("Copy ip to clipboard: Error: " + msg); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | export function updateButtonData(state, handleConnect) { |
| 110 | switch(state) { |