From 9a1fa3fbce94ff18812b2eb0fccf044bb9d62b69 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 7 Mar 2025 22:43:45 +0530 Subject: [PATCH] feat: set active browser --- .../browser-management/classes/BrowserPool.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/server/src/browser-management/classes/BrowserPool.ts b/server/src/browser-management/classes/BrowserPool.ts index a52c85d6..b3002100 100644 --- a/server/src/browser-management/classes/BrowserPool.ts +++ b/server/src/browser-management/classes/BrowserPool.ts @@ -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; + }; + + } \ No newline at end of file