fix(core): update

This commit is contained in:
2019-06-04 08:29:05 +02:00
parent f2430d095f
commit 35e5ded808
4 changed files with 32 additions and 28 deletions

View File

@ -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();
}
}

View File

@ -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 };