Commit 6b9b338f authored by Fred Chasen's avatar Fred Chasen
Browse files

Merge branch 'await-before-call-after' into 'master'

Await `window.PagedConfig.before` and / or call `after` if set

Closes #47

See merge request !19
parents a960c2b6 b3579f5a
Pipeline #756 passed with stages
in 1 minute and 13 seconds
......@@ -183,7 +183,8 @@ class Printer extends EventEmitter {
resolver({msg, width, height, orientation});
});
await page.evaluate(() => {
await page.evaluate(async () => {
let done;
window.PagedPolyfill.on("page", (page) => {
const { id, width, height, startToken, endToken, breakAfter, breakBefore, position } = page;
......@@ -221,7 +222,15 @@ class Printer extends EventEmitter {
window.onRendered(msg, flow.width, flow.height, flow.orientation);
});
window.PagedPolyfill.preview();
if (window.PagedConfig.before) {
await window.PagedConfig.before();
}
done = await window.PagedPolyfill.preview();
if (window.PagedConfig.after) {
await window.PagedConfig.after(done);
}
});
await rendered;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment