Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions maxun-core/src/interpret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
Loading