fix(core): update

This commit is contained in:
2020-02-25 07:48:54 +00:00
parent e6a87e408e
commit 989634d276
5 changed files with 32 additions and 27 deletions

View File

@ -23,8 +23,11 @@ export class SmartSSR {
public async renderPage(urlArg: string) {
const resultDeferred = plugins.smartpromise.defer<string>();
const page = await this.browser.newPage();
page.on('console', (event: any) => console.log(event._text));
const context = await this.browser.createIncognitoBrowserContext();
const page = await context.newPage();
page.on('console', msg => {
console.log(`${urlArg}: ${msg.text()}`);
});
page.on('load', async (...args) => {
// await plugins.smartdelay.delayFor(2000);
@ -40,7 +43,9 @@ export class SmartSSR {
await page.goto(urlArg);
const result = await resultDeferred.promise;
page.close();
page.close().then(async () => {
await context.close();
});
return result;
}
}

View File

@ -67,7 +67,7 @@ export function serializeFunction(rootNode) {
node.appendChild(templateDom);
}
} catch (err) {
console.log('error:', err);
console.log('error:', err.message);
console.log(node.tagName);
}
}