-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force Chrome to clear cache before opening a URL #56
Conversation
…source HTML not appearing in PDF
Please make this an option, and not something that happens every time. Add the property |
@@ -61,7 +61,9 @@ async function generate(html: string, options: CreateOptions): Promise<CreateRes | |||
await throwIfCanceled(options); | |||
const client = await CDP(options); | |||
try { | |||
const {Network} = client; | |||
const {Page} = client; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine into:
const {Network, Page} = client;
const {Page} = client; | ||
await Network.clearBrowserCache(); // Clear cache to force chrome to load a fresh copy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for the added option (see PR comment):
if (options.clearCache) {
await Network.clearBrowserCache();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put an await throwIfCanceled(options);
above this if
check, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea. will do and update.
Codecov Report
@@ Coverage Diff @@
## master #56 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 108 110 +2
Branches 12 12
=====================================
+ Hits 108 110 +2
Continue to review full report at Codecov.
|
Fixed in 652502f. |
Usage: const options: HtmlPdf.CreateOptions = {
port,
clearCache: true,
}; |
No description provided.