fix(core): update

This commit is contained in:
Philipp Kunz 2019-06-03 13:00:06 +02:00
parent e4287e9943
commit 63f4321b04

View File

@ -11,16 +11,22 @@ export class SmartPdf {
htmlServerInstance: Server; htmlServerInstance: Server;
serverPort: number; serverPort: number;
headlessBrowser: plugins.puppeteer.Browser; headlessBrowser: plugins.puppeteer.Browser;
externalBrowser: boolean = false;
private _readyDeferred: plugins.smartpromise.Deferred<void>; private _readyDeferred: plugins.smartpromise.Deferred<void>;
private _candidates: { [key: string]: PdfCandidate } = {}; private _candidates: { [key: string]: PdfCandidate } = {};
constructor() { constructor(headlessBrowserArg?) {
this.headlessBrowser = headlessBrowserArg
this._readyDeferred = new plugins.smartpromise.Deferred(); this._readyDeferred = new plugins.smartpromise.Deferred();
} }
async start() { async start() {
// setup puppeteer // setup puppeteer
if (!this.headlessBrowser) {
this.headlessBrowser = await plugins.puppeteer.launch(); this.headlessBrowser = await plugins.puppeteer.launch();
} else {
this.externalBrowser = true;
}
// setup server // setup server
const app = plugins.express(); const app = plugins.express();