feat: add mode param options
This commit is contained in:
@@ -37,6 +37,7 @@ declare global {
|
||||
* Defines optional intepreter options (passed in constructor)
|
||||
*/
|
||||
interface InterpreterOptions {
|
||||
mode?: string;
|
||||
maxRepeats: number;
|
||||
maxConcurrency: number;
|
||||
serializableCallback: (output: any) => (void | Promise<void>);
|
||||
@@ -432,6 +433,11 @@ export default class Interpreter extends EventEmitter {
|
||||
if (this.options.debugChannel?.setActionType) {
|
||||
this.options.debugChannel.setActionType('scrapeSchema');
|
||||
}
|
||||
|
||||
if (this.options.mode && this.options.mode === 'editor') {
|
||||
await this.options.serializableCallback({});
|
||||
return;
|
||||
}
|
||||
|
||||
await this.ensureScriptsLoaded(page);
|
||||
|
||||
@@ -463,6 +469,11 @@ export default class Interpreter extends EventEmitter {
|
||||
this.options.debugChannel.setActionType('scrapeList');
|
||||
}
|
||||
|
||||
if (this.options.mode && this.options.mode === 'editor') {
|
||||
await this.options.serializableCallback({});
|
||||
return;
|
||||
}
|
||||
|
||||
await this.ensureScriptsLoaded(page);
|
||||
if (!config.pagination) {
|
||||
const scrapeResults: Record<string, any>[] = await page.evaluate((cfg) => window.scrapeList(cfg), config);
|
||||
|
||||
Reference in New Issue
Block a user