feat:stop interpretatopn of current workflow in active browser instance

This commit is contained in:
karishmas6
2024-06-01 11:22:23 +05:30
parent c6d740f3ce
commit fc57daef61

View File

@@ -139,4 +139,19 @@ export const interpretWholeWorkflow = async() => {
logger.log('error', `Cannot interpret the workflow: bad id ${id}.`);
}
};
/**
* Stops the interpretation of the current workflow in the active browser instance.
* If there is no active browser, the function logs an error.
* @returns {Promise<void>}
* @category BrowserManagement-Controller
*/
export const stopRunningInterpretation = async() => {
const id = getActiveBrowserId();
if (id) {
const browser = browserPool.getRemoteBrowser(id);
await browser?.stopCurrentInterpretation();
} else {
logger.log('error', 'Cannot stop interpretation: No active browser or generator.');
}
};