fixed build libs
This commit is contained in:
parent
b03231b849
commit
42baadae38
26 changed files with 981 additions and 541 deletions
|
|
@ -9,7 +9,7 @@ export class SimpleBrowser {
|
|||
private contexts = new Map<string, any>();
|
||||
private logger: any;
|
||||
private initialized = false;
|
||||
private options: BrowserOptions = {
|
||||
private _options: BrowserOptions = {
|
||||
headless: true,
|
||||
timeout: 30000,
|
||||
blockResources: false,
|
||||
|
|
@ -55,7 +55,7 @@ export class SimpleBrowser {
|
|||
}
|
||||
|
||||
// Merge options
|
||||
this.options = { ...this.options, ...options };
|
||||
this._options = { ...this._options, ...options };
|
||||
|
||||
this.logger.info('Initializing browser...');
|
||||
|
||||
|
|
@ -91,8 +91,8 @@ export class SimpleBrowser {
|
|||
const page = await context.newPage();
|
||||
|
||||
// Add resource blocking if enabled
|
||||
if (this.options?.blockResources) {
|
||||
await page.route('**/*.{png,jpg,jpeg,gif,svg,ico,woff,woff2,ttf,css}', route => {
|
||||
if (this._options?.blockResources) {
|
||||
await page.route('**/*.{png,jpg,jpeg,gif,svg,ico,woff,woff2,ttf,css}', (route: any) => {
|
||||
route.abort();
|
||||
});
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ export class SimpleBrowser {
|
|||
|
||||
async goto(page: Page, url: string, options?: any): Promise<void> {
|
||||
await page.goto(url, {
|
||||
timeout: this.options?.timeout || 30000,
|
||||
timeout: this._options?.timeout || 30000,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
|
@ -143,6 +143,7 @@ export class SimpleBrowser {
|
|||
success: false,
|
||||
error: error.message,
|
||||
url,
|
||||
data: {} as any,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -163,12 +164,4 @@ export class SimpleBrowser {
|
|||
this.initialized = false;
|
||||
}
|
||||
|
||||
private get options(): BrowserOptions {
|
||||
return {
|
||||
headless: true,
|
||||
timeout: 30000,
|
||||
blockResources: false,
|
||||
enableNetworkLogging: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue