How to use the chrome-launcher/dist/utils.js.getPlatform function in chrome-launcher

To help you get started, we’ve selected a few chrome-launcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shower / cli / core / command / pdf.js View on Github external
async function handler ({ cwd, output }) {
  const executablePath = process.env.PUPPETEER_EXECUTABLE_PATH || (await (chromeFinder)[getPlatform()]())[0]
  if (!executablePath) {
    throw new Error('Chrome / Chromium is not installed or environment variable PUPPETEER_EXECUTABLE_PATH is not set')
  }
  let browser = await puppeteer.launch({ executablePath })
  let page = await browser.newPage()

  await page.goto(`file://${cwd}/index.html`)

  const [width, height] = await page.evaluate(async () => {
    const container = document.querySelector('.shower')

    const styles = window.getComputedStyle(container)

    return [
      styles.getPropertyValue('--slide-width'),
      styles.getPropertyValue('--slide-height')