donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
26 lines • 703 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FocusPage = void 0;
/**
* A binding that brings the page executing this callback into focus.
*/
class FocusPage {
constructor(focusedPage) {
this.focusedPage = focusedPage;
}
name() {
return FocusPage.NAME;
}
call(source, ...args) {
const tabUrl = args[0];
const page = source.context.pages().find((tab) => tab.url() === tabUrl);
if (page) {
this.focusedPage.current = page;
return true;
}
return false;
}
}
exports.FocusPage = FocusPage;
FocusPage.NAME = 'donobuFocusPage';
//# sourceMappingURL=FocusPage.js.map