haast
v0.1.0
Published
Collect web pages meaningful performance metrics.
Downloads
4
Maintainers
Readme
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')
})