MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / initHub

Function initHub

app/src/modules/hub.js:580–619  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

578}
579
580export function initHub() {
581 migrateServerList();
582 renderHubCards();
583 startHubProbes();
584
585 $('hub-add-btn').addEventListener('click', openAddServerDialog);
586 $('hub-dialog-cancel').addEventListener('click', closeServerDialog);
587 $('hub-dialog-save').addEventListener('click', saveServerDialog);
588 $('hub-dialog-delete').addEventListener('click', deleteServerFromDialog);
589 $('hub-add-overlay').addEventListener('click', (e) => {
590 if (e.target === $('hub-add-overlay')) closeServerDialog();
591 });
592 $('hub-dialog-addr').addEventListener('keydown', e => {
593 if (e.key === 'Enter') saveServerDialog();
594 });
595 $('hub-dialog-token-toggle').addEventListener('click', () => {
596 const inp = $('hub-dialog-token');
597 inp.type = inp.type === 'password' ? 'text' : 'password';
598 });
599
600 // Back button
601 $('btn-back').addEventListener('click', () => {
602 (async () => {
603 const hadWs = !!S.ws;
604 S.intentionalDisconnect = hadWs;
605 S.skipNextCloseHandling = hadWs;
606 try {
607 await flushSessionCacheSave();
608 } catch {}
609 if (S.ws) S.ws.close();
610 else {
611 S.intentionalDisconnect = false;
612 S.skipNextCloseHandling = false;
613 }
614 if (S.reconnectTimer) { clearTimeout(S.reconnectTimer); S.reconnectTimer = null; }
615 resetAppState();
616 showConnectScreen();
617 })();
618 });
619}

Callers

nothing calls this directly

Calls 9

$Function · 0.90
flushSessionCacheSaveFunction · 0.90
migrateServerListFunction · 0.70
renderHubCardsFunction · 0.70
startHubProbesFunction · 0.70
closeServerDialogFunction · 0.70
saveServerDialogFunction · 0.70
resetAppStateFunction · 0.70
showConnectScreenFunction · 0.70

Tested by

no test coverage detected