Collect web pages meaningful performance metrics.
npm install haast
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: {
/* ... */
}
}
Loads the given URL and returns a promise resolving to collected metrics.
const metrics = await haast('https://google.com')
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')
})