fix(core): update
This commit is contained in:
parent
f2430d095f
commit
35e5ded808
9
package-lock.json
generated
9
package-lock.json
generated
@ -282,6 +282,15 @@
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.0.2.tgz",
|
||||
"integrity": "sha512-jmrJMUEmBCWChWK8CIcx4Vw3wv/8OgVNmkaxJrbs+WMaoRUfJtpWWJfrAwwHWt9ZXJbarJ+CwfwfYiiZXymndQ=="
|
||||
},
|
||||
"@pushrocks/smartpuppeteer": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpuppeteer/-/smartpuppeteer-1.0.5.tgz",
|
||||
"integrity": "sha512-7iD2mxQHXG5/6PwZY2wU6GQjNXy9dR5cLP/nvfjxXaelX/x3N1yagjPAuMYxuIqiTtVfrHC4Ehq+gnTZ4mSPow==",
|
||||
"requires": {
|
||||
"@types/puppeteer": "^1.12.4",
|
||||
"puppeteer": "^1.17.0"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrequest": {
|
||||
"version": "1.1.15",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.15.tgz",
|
||||
|
@ -21,8 +21,8 @@
|
||||
"dependencies": {
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartpdf": "^1.0.17",
|
||||
"@pushrocks/smartunique": "^3.0.1",
|
||||
"puppeteer": "^1.17.0"
|
||||
"@pushrocks/smartpuppeteer": "^1.0.5",
|
||||
"@pushrocks/smartunique": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.11",
|
||||
|
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 };
|
||||
|
Loading…
Reference in New Issue
Block a user