BREAKING CHANGE(API): now clearly naming PDF Results what they are.
This commit is contained in:
parent
1155656c2b
commit
9c19b4a3e4
@ -13,11 +13,11 @@ tap.test('should start the instance', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should create a pdf from html string', async () => {
|
tap.test('should create a pdf from html string', async () => {
|
||||||
await testSmartPdf.getPdfForHtmlString('hi');
|
await testSmartPdf.getPdfResultForHtmlString('hi');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should create a pdf from website as A4', async () => {
|
tap.test('should create a pdf from website as A4', async () => {
|
||||||
await testSmartPdf.getPdfForWebsite('https://www.wikipedia.org');
|
await testSmartPdf.getPdfResultForWebsite('https://www.wikipedia.org');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should create a pdf from website as single page PDF', async () => {
|
tap.test('should create a pdf from website as single page PDF', async () => {
|
||||||
|
@ -63,7 +63,7 @@ export class SmartPdf {
|
|||||||
/**
|
/**
|
||||||
* returns a pdf for a given html string;
|
* returns a pdf for a given html string;
|
||||||
*/
|
*/
|
||||||
async getPdfForHtmlString(htmlStringArg: string): Promise<interfaces.IPdfResult> {
|
async getPdfResultForHtmlString(htmlStringArg: string): Promise<interfaces.IPdfResult> {
|
||||||
await this._readyDeferred.promise;
|
await this._readyDeferred.promise;
|
||||||
const pdfCandidate = new PdfCandidate(htmlStringArg);
|
const pdfCandidate = new PdfCandidate(htmlStringArg);
|
||||||
this._candidates[pdfCandidate.pdfId] = pdfCandidate;
|
this._candidates[pdfCandidate.pdfId] = pdfCandidate;
|
||||||
@ -96,7 +96,7 @@ export class SmartPdf {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPdfForWebsite(websiteUrl: string): Promise<interfaces.IPdfResult> {
|
async getPdfResultForWebsite(websiteUrl: string): Promise<interfaces.IPdfResult> {
|
||||||
const page = await this.headlessBrowser.newPage();
|
const page = await this.headlessBrowser.newPage();
|
||||||
await page.emulateMedia('screen');
|
await page.emulateMedia('screen');
|
||||||
const response = await page.goto(websiteUrl, { waitUntil: 'networkidle2' });
|
const response = await page.goto(websiteUrl, { waitUntil: 'networkidle2' });
|
||||||
|
Loading…
Reference in New Issue
Block a user