Nothing Special   »   [go: up one dir, main page]

Skip to content

⏱️ Collect web pages meaningful performance metrics.

License

Notifications You must be signed in to change notification settings

speedracer/haast

Repository files navigation

Haast

travis codecov

Collect web pages meaningful performance metrics.

Quickstart

Installation

npm install haast

Usage

import haast from 'haast'

const metrics = await haast('https://google.com')
console.log(metrics)
{
  timings: {
    navigationStart: 0,
    domContentLoaded: 200,
    firstPaint: 400,
    firstContentfulPaint: 400,
    firstMeaningfulPaint: 600,
    load: 1000
  }
  events: {
    /* ... */
  }
}

API

haast(url)

Loads the given URL and returns a promise resolving to collected metrics.

const metrics = await haast('https://google.com')

metrics(callback)

Accepts a callback that handles navigation and returns a promise when it's done. The page argument is a Puppeteer page instance.

const metrics = await haast(page => {
  await page.goto('http://www.nooooooooooooooo.com')
  await page.click('#no-button')
})

About

⏱️ Collect web pages meaningful performance metrics.

Resources

License

Stars

Watchers

Forks

Packages

No packages published