fix(core): update
This commit is contained in:
41
ts/index.ts
41
ts/index.ts
@ -6,9 +6,26 @@ import * as interfaces from './interfaces';
|
||||
* SmartBrowser
|
||||
*/
|
||||
export class SmartBrowser {
|
||||
public headlessBrowser: plugins.puppeteer.Browser;
|
||||
public headlessBrowser: plugins.smartpuppeteer.puppeteer.Browser;
|
||||
public smartpdf: plugins.smartpdf.SmartPdf;
|
||||
|
||||
/**
|
||||
* start the SmartBrowser instance
|
||||
*/
|
||||
public async start() {
|
||||
this.headlessBrowser = await plugins.smartpuppeteer.getEnvAwareBrowserInstance();
|
||||
this.smartpdf = new plugins.smartpdf.SmartPdf();
|
||||
await this.smartpdf.start(this.headlessBrowser);
|
||||
}
|
||||
|
||||
/**
|
||||
* stop the SmartBrowser instance
|
||||
*/
|
||||
public async stop() {
|
||||
await this.headlessBrowser.close();
|
||||
await this.smartpdf.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* create a pdf from page
|
||||
* @param urlArg
|
||||
@ -51,25 +68,5 @@ export class SmartBrowser {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* start a page
|
||||
*/
|
||||
public async start() {
|
||||
this.headlessBrowser = await plugins.puppeteer.launch({
|
||||
defaultViewport: {
|
||||
width: 1600,
|
||||
height: 1080
|
||||
}
|
||||
});
|
||||
this.smartpdf = new plugins.smartpdf.SmartPdf();
|
||||
await this.smartpdf.start(this.headlessBrowser);
|
||||
}
|
||||
|
||||
/**
|
||||
* stops the smartbrowser instance
|
||||
*/
|
||||
public async stop() {
|
||||
await this.headlessBrowser.close();
|
||||
await this.smartpdf.stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
// pushrocks scope
|
||||
import * as smartpdf from '@pushrocks/smartpdf';
|
||||
import * as smartpuppeteer from '@pushrocks/smartpuppeteer';
|
||||
import * as smartunique from '@pushrocks/smartunique';
|
||||
|
||||
export { smartpdf, smartunique };
|
||||
export { smartpdf, smartpuppeteer, smartunique };
|
||||
|
||||
// third party
|
||||
import puppeteer from 'puppeteer';
|
||||
|
||||
export { puppeteer };
|
||||
|
Reference in New Issue
Block a user