0.0.0 • Published 8 years ago

perf-track v0.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

perf-track

Tiny (<1kb before gzip) dependency-free JS perf tracker.

Usage

<script src='perfTrack.min.js'></script>
<script>
  perfTrack({
    frameDurationThreshold: 200,
    startAfter: 1000,
    bailOut: false,
  }, function(frameDuration, hidden) {
    if(!hidden) {
      ga('send', 'perfTrack', 'slowFrame', window.location.href, frameDuration);
    }
  });
</script>

Options

  • frameDurationThreshold: the duration threshold, in ms, above which a frame will be reported as slow.
  • startAfter: don't report slow frames before this timeout.
  • bailOut: don't report slow frames more than once.

Running the tests

The tests use karma which can be painful to install if you haven't installed native modules before. You will require:

Once you're set up,

  • run npm install
  • run bower install
  • run gulp test