feat: make and emit ss to client

This commit is contained in:
karishmas6
2024-06-01 10:59:49 +05:30
parent 8c23ef965d
commit 83740fa70c

View File

@@ -174,4 +174,21 @@ export class RemoteBrowser {
}
};
/**
* Makes and emits a single screenshot to the client side.
* @returns {Promise<void>}
*/
public makeAndEmitScreenshot = async() : Promise<void> => {
try {
const screenshot = await this.currentPage?.screenshot();
if (screenshot) {
this.emitScreenshot(screenshot.toString('base64'));
}
} catch (e) {
const { message } = e as Error;
logger.log('error', message);
}
};
}