INNER CODE UNIT · TypeScript
getActivePage
hyperbrowserai/HyperAgent · src/agent/index.ts:1483
const getActivePage = () => pageStack[pageStack.length - 1];
// Handle tab closing (Pop)
const handleClose = (p: Page) => {
const idx = pageStack.indexOf(p);
if (idx !== -1) {
if (this.debug) {
console.log(`[HyperPage] Tab closed, removing from stack`);
}
pageStack.splice(idx, 1);
}
};
// Listen for close on the root page
page.on("close", () => handleClose(page));
// Handle new tabs (Push)
const onPage = async (newPage: Page) => {
try {