MCPcopy Create free account
hub / github.com/garrytan/gstack / switchTab

Method switchTab

browse/src/browser-manager.ts:818–827  ·  view source on GitHub ↗
(id: number, opts?: { bringToFront?: boolean })

Source from the content-addressed store, hash-verified

816 }
817
818 switchTab(id: number, opts?: { bringToFront?: boolean }): void {
819 if (!this.tabSessions.has(id)) throw new Error(`Tab ${id} not found`);
820 this.activeTabId = id;
821 // Only bring to front when explicitly requested (user-initiated tab switch).
822 // Internal tab pinning (BROWSE_TAB) should NOT steal focus.
823 if (opts?.bringToFront !== false) {
824 const page = this.pages.get(id);
825 if (page) page.bringToFront().catch(() => {});
826 }
827 }
828
829 /**
830 * Sync activeTabId to match the tab whose URL matches the Chrome extension's

Callers 3

commands.test.tsFile · 0.80
handleMetaCommandFunction · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected