Skip to content

A build of devtools-frontend with some polyfills to make the tracing API useable in Node.

Notifications You must be signed in to change notification settings

emereum/devtools-frontend-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devtools-frontend-api

A build of devtools-frontend with some polyfills to make the tracing API useable in Node.

Usage

yarn add emereum/devtools-frontend-api
import 'devtools-frontend-api/devtools_frontend_polyfills.js';
import { TraceModel } from 'devtools-frontend-api/dist/models/trace/trace';
import * as Handlers from 'devtools-frontend-api/dist/models/trace/handlers/handlers';
import { promises as fs } from 'fs';

(async function() {
    const traceFile = JSON.parse(await fs.readFile('./path/to/trace', { encoding: 'utf-8' }));
    const model = new TraceModel.Model({
      userTimings: Handlers.ModelHandlers.UserTimings,
      pageLoadMetrics: Handlers.ModelHandlers.PageLoadMetrics,
      Screenshots: Handlers.ModelHandlers.Screenshots,
      layoutShifts: Handlers.ModelHandlers.LayoutShifts,
    });
    await model.parse(traceFile.traceEvents);
    const trace = model.traceParsedData(0);
    console.log(JSON.stringify(trace, null, 2));
})();

About

A build of devtools-frontend with some polyfills to make the tracing API useable in Node.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published