feat: set active browser

This commit is contained in:
amhsirak
2025-03-07 22:43:45 +05:30
parent 59e494c9be
commit 9a1fa3fbce

View File

@@ -196,5 +196,23 @@ export class BrowserPool {
return this.pool[browserId].userId;
};
/**
* Sets the active state of a browser.
*
* @param id the browser ID
* @param active the new active state
* @returns true if successful, false if the browser wasn't found
*/
public setActiveBrowser = (id: string, active: boolean): boolean => {
if (!this.pool[id]) {
logger.log('warn', `Remote browser with id: ${id} does not exist in the pool`);
return false;
}
this.pool[id].active = active;
logger.log('debug', `Remote browser with id: ${id} set to ${active ? 'active' : 'inactive'}`);
return true;
};
}