GithubHelp home page GithubHelp logo

alexxnica / devtools-timeline-model-browser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from addyosmani/devtools-timeline-model-browser

0.0 1.0 0.0 688 KB

Browser-friendly helper for parsing DevTools Timeline traces into structured profiling data models

License: MIT License

JavaScript 100.00%

devtools-timeline-model-browser's Introduction

devtools-timeline-model-browser

GitHub version npm version Dependency Status

Browser-friendly library for parsing DevTools Timeline traces into structured profiling data models. Heavily inspired by devtools-timeline-model. Should work in any modern browser.

Develop

$ git clone https://github.com/addyosmani/devtools-timeline-model-browser
$ cd devtools-timeline-model-browser
$ npm install
# or $ yarn if you have yarn installed

To build the source run webpack or npm run build.

Usage

dist contains a globals-friendly timeline-model-browser.js build that can be dropped into any page. e.g:

<script src='dist/timeline-model-browser.js'></script>

From there, you'll have access to a new global, TimelineModelBrowser that can be passed the contents of any valid trace file.

const traceFileContents = '...'; // Let's pretend you've fetched a trace file
const model = new TimelineModelBrowser(traceFileContents);

You'll now have access to the same helpers available in the devtools-timeline-model package:

// tracing model
model.tracingModel()
// timeline model, all events
model.timelineModel()
// interaction model, incl scroll, click, animations
model.interactionModel()
// frame model, incl frame durations
model.frameModel()
// filmstrip model, incl screenshots
model.filmStripModel()

// topdown tree
model.topDown()
// bottom up tree
model.bottomUp()
// bottom up tree, grouped by URL
model.bottomUpGroupBy('URL') // accepts: None Category Subdomain Domain URL EventName

Demo

A demo that uses the dist build is available in the demo directory. Fire up a local server in the repo root, then navigate to /demo/ to try it out. Instructions are included in the index.

Why

Is this useful?

The Chrome DevTools Timeline allows you to save traces by right-clicking on the Timeline waterfall. The trace format of these files can be dense, but contains detailed information useful for anyone building web performance tooling. The goal of this module is to bring the benefits of the devtools-timeline-model package to the browser so folks can easily build tools that consume and reuse this data outside of writing a DevTools extension or using Node.

This package?

devtools-timeline-model is an excellent package if you're trying to build tools targeting a Node environment that want to parse DevTools traces into an easy to reason about model. A few assumptions are built into that package, including use of Node built-ins, such as fs, resolve and so on.

I found that shimming these with browserify-fs and the brfs transforms were not sufficient to create a browser-friendly version of that package, so this is a complimentary repo that lets you easily reuse that work in the browser.

License

Apache © Addy Osmani

devtools-timeline-model-browser's People

Contributors

addyosmani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.