Apply linter

This commit is contained in:
lowlighter
2021-03-03 16:17:08 +01:00
parent 56e3ff6ae1
commit d9d7bfdf9c

View File

@@ -155,15 +155,15 @@
const padding = {width:pw, height:ph ?? pw}
console.debug(`metrics/svg/resize > padding width*${padding.width}, height*${padding.height}`)
//Render through browser and resize height
console.debug(`metrics/svg/resize > loading svg`)
console.debug("metrics/svg/resize > loading svg")
const page = await svg.resize.browser.newPage()
page.on("console", ({_text:text}) => console.debug(`metrics/svg/resize > puppeteer > ${text}`))
await page.setContent(rendered, {waitUntil:["load", "domcontentloaded", "networkidle2"]})
console.debug(`metrics/svg/resize > loaded svg successfully`)
console.debug("metrics/svg/resize > loaded svg successfully")
await page.addStyleTag({content:"body { margin: 0; padding: 0; }"})
let mime = "image/svg+xml"
console.debug(`metrics/svg/resize > resizing svg`)
let resized, width, height
console.debug("metrics/svg/resize > resizing svg")
let height, resized, width
try {
({resized, width, height} = await page.evaluate(async padding => {
//Disable animations
@@ -171,7 +171,7 @@
if (animated)
document.querySelector("svg").classList.add("no-animations")
console.debug(`animations are ${animated ? "enabled" : "disabled"}`)
await new Promise(solve => setTimeout(solve, 2400))
await new Promise(solve => setTimeout(solve, 2400)) //eslint-disable-line no-promise-executor-return
//Get bounds and resize
let {y:height, width} = document.querySelector("svg #metrics-end").getBoundingClientRect()
console.debug(`bounds width=${width}, height=${height}`)
@@ -200,7 +200,7 @@
}
//Result
await page.close()
console.debug(`metrics/svg/resize > rendering complete`)
console.debug("metrics/svg/resize > rendering complete")
return {resized, mime}
},
/**Render twemojis */