Feat plugin improves (#214)

This commit is contained in:
Simon Lecoq
2021-04-08 20:13:47 +02:00
committed by GitHub
parent 8da565b2af
commit 7f3a1b365e
8 changed files with 80 additions and 15 deletions

View File

@@ -198,7 +198,7 @@
if (animated)
document.querySelector("svg").classList.add("no-animations")
console.debug(`animations are ${animated ? "enabled" : "disabled"}`)
await new Promise(solve => setTimeout(solve, 2400)) //eslint-disable-line no-promise-executor-return
await new Promise(solve => setTimeout(solve, 2400))
//Get bounds and resize
let {y:height, width} = document.querySelector("svg #metrics-end").getBoundingClientRect()
console.debug(`bounds width=${width}, height=${height}`)
@@ -270,7 +270,7 @@
/**Wait */
export async function wait(seconds) {
await new Promise(solve => setTimeout(solve, seconds*1000)) //eslint-disable-line no-promise-executor-return
await new Promise(solve => setTimeout(solve, seconds*1000))
}
/**Create record from puppeteer browser */
@@ -306,7 +306,7 @@
//Register frames
for (let i = 0; i < frames; i++) {
const buffer = new PNG(await page.screenshot({clip:{width, height, x, y}}))
encoder.addFrame(await new Promise(solve => buffer.decode(pixels => solve(pixels)))) //eslint-disable-line no-promise-executor-return
encoder.addFrame(await new Promise(solve => buffer.decode(pixels => solve(pixels))))
if (frames%10 === 0)
console.debug(`metrics/puppeteergif > processed ${i}/${frames} frames`)
}