fix(core): update
This commit is contained in:
parent
042caeeeb5
commit
759fa1ff43
16382
package-lock.json
generated
16382
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,10 +9,6 @@ tap.test('should create a valid smartssr instance', async () => {
|
||||
});
|
||||
});
|
||||
|
||||
tap.test('should start the smartssr instance', async () => {
|
||||
await testSSRInstance.start();
|
||||
});
|
||||
|
||||
tap.test('should render central.eu', async (tools) => {
|
||||
await testSSRInstance.renderPage('https://lossless.com');
|
||||
});
|
||||
@ -26,8 +22,4 @@ tap.skip.test('should render https://lossless.gmbh', async () => {
|
||||
console.log(renderedPage);
|
||||
});
|
||||
|
||||
tap.test('should stop the smartssr instance', async () => {
|
||||
await testSSRInstance.stop();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -11,7 +11,6 @@ export interface ISmartSSROptions {
|
||||
*
|
||||
*/
|
||||
export class SmartSSR {
|
||||
public browser: plugins.smartpuppeteer.IncognitoBrowser;
|
||||
public options: ISmartSSROptions;
|
||||
|
||||
constructor(optionsArg?: ISmartSSROptions) {
|
||||
@ -23,25 +22,13 @@ export class SmartSSR {
|
||||
};
|
||||
}
|
||||
|
||||
public async start() {
|
||||
this.browser = new plugins.smartpuppeteer.IncognitoBrowser();
|
||||
await this.browser.start();
|
||||
}
|
||||
public async stop() {
|
||||
if (this.browser) {
|
||||
await plugins.smartdelay.delayFor(3000);
|
||||
await this.browser.stop();
|
||||
this.browser = null;
|
||||
} else {
|
||||
console.log('browser was not in started mode');
|
||||
}
|
||||
}
|
||||
|
||||
public async renderPage(urlArg: string) {
|
||||
const overallTimeMeasurement = new plugins.smarttime.HrtMeasurement();
|
||||
overallTimeMeasurement.start();
|
||||
const resultDeferred = plugins.smartpromise.defer<string>();
|
||||
const context = await this.browser.getNewIncognitoContext();
|
||||
const browser = new plugins.smartpuppeteer.IncognitoBrowser();
|
||||
await browser.start();
|
||||
const context = await browser.getNewIncognitoContext();
|
||||
const page = await context.newPage();
|
||||
|
||||
// lets protext against left open tabs
|
||||
@ -84,6 +71,7 @@ export class SmartSSR {
|
||||
// lets clean up async
|
||||
await page.close();
|
||||
await context.close();
|
||||
await browser.stop();
|
||||
|
||||
overallTimeMeasurement.stop();
|
||||
console.log(
|
||||
|
Loading…
Reference in New Issue
Block a user