feat: add browser instace to pool

This commit is contained in:
karishmas6
2024-06-01 10:25:04 +05:30
parent e68f8b84c8
commit 026577bf88

View File

@@ -39,4 +39,21 @@ export class BrowserPool {
* Holds all the instances of remote browsers.
*/
private pool : PoolDictionary = {};
/**
* Adds a remote browser instance to the pool indexed by the id.
* @param id remote browser instance's id
* @param browser remote browser instance
* @param active states if the browser's instance is being actively used
*/
public addRemoteBrowser = (id: string, browser: RemoteBrowser, active: boolean = false): void => {
this.pool = {
...this.pool,
[id]: {
browser,
active,
},
}
logger.log('debug', `Remote browser with id: ${id} added to the pool`);
};
}