UNPKG

overmind-devtools

Version:
61 lines (55 loc) 2.52 kB
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta http-equiv="X-UA-Compatible" content="ie=edge"/><title>Overmind DevTools</title><link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet"/><link href="https://fonts.googleapis.com/css?family=Nunito:400,700" rel="stylesheet"/><script>// Port configuration injected by webpack template window.__OVERMIND_DEVTOOLS_BACKEND_PORT__ = '' const vscode = window.vscode || (window.acquireVsCodeApi && window.acquireVsCodeApi()) const isVSCodeExtension = typeof window !== 'undefined' && (window.vscode !== undefined || typeof window.acquireVsCodeApi === 'function') const isElectron = isVSCodeExtension ? false : !!window.electronEnv?.isRenderer function onPortSubmit(newPort) { if (isVSCodeExtension) { try { vscode.postMessage({ command: 'newPort', text: newPort }) } catch (err) { console.error('Failed to send message to VSCode:', err) } } else if (isElectron) { try { window.electronAPI.setNewPort(Number(newPort)) } catch (err) { window.location.href = `${window.location.origin}${window.location.pathname}?port=${newPort}` } } else { window.location.href = `${window.location.origin}${window.location.pathname}?port=${newPort}` } } function onRestart() { if (isVSCodeExtension) { try { vscode.postMessage({ command: 'restart' }) } catch (err) { console.error('Failed to send restart message to VSCode:', err) } } else if (isElectron) { try { window.electronAPI.restart() } catch (err) { console.error('Failed to send restart message in Electron:', err) } } } function handleFormSubmit(event) { event.preventDefault() var input = document.querySelector('#port-input') var port = input.value input.setAttribute('disabled', true) if (isNaN(port) || port < 1 || port > 65535) { alert('Please enter a valid port number (1-65535)') input.removeAttribute('disabled') return } onPortSubmit(port) }</script><script defer="defer" src="bundle.js"></script></head><body></body></html>