Skip to content

Instantly share code, notes, and snippets.

@wioux
Created April 17, 2018 00:07
Show Gist options
  • Save wioux/7da667347f6c8365d154f3d7bbee8071 to your computer and use it in GitHub Desktop.
Save wioux/7da667347f6c8365d154f3d7bbee8071 to your computer and use it in GitHub Desktop.
diff --git a/index.js b/index.js
index 6b53ab4..b6dce0b 100644
--- a/index.js
+++ b/index.js
@@ -87,15 +87,16 @@ class RenderPDF {
await LayerTree.enable();
await Page.navigate({url});
- await Emulation.setVirtualTimePolicy({policy: 'pauseIfNetworkFetchesPending', budget: 5000});
const loaded = this.cbToPromise(Page.loadEventFired);
- const jsDone = this.cbToPromise(Emulation.virtualTimeBudgetExpired);
await this.profileScope('Wait for load', async () => {
await loaded;
});
+ await Emulation.setVirtualTimePolicy({policy: 'pauseIfNetworkFetchesPending', budget: 5000});
+ const jsDone = this.cbToPromise(Emulation.virtualTimeBudgetExpired);
+
await this.profileScope('Wait for js execution', async () => {
await jsDone;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment