0.2.1 • Published 5 years ago

perfback v0.2.1

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

perfback

Build Status Coverage Status

A simple callback performance monitor, compatible with IE11 and above.

import PerfBack from 'perfback';
// or const PerfBack = require('perfback');

const pb = new PerfBack(
  production,   // boolean value to specify it's production code or not
                // if true, the pb.measure(fn) method would return just the fn
  ignoreLogs    // to indicate if logs should be shown in console
                // false by default (pass true to avoid logging)
);

// all methods are self bound
const {measure, start, end} = pb;


// pass a function
const fn = measure(() => {});

// or a name to log, and a function
const fn = measure('noop', () => {});

// from now on, every fn() call will log its invoking duration
fn();

// create a mark unique id
const id = start('description');

// whenever is convenient, clear the mark and read the log
end(id);

// if you'd like to stop logging a specific PerfBack object
pb.log = false;
// from now on all marks that where not set won't measure performance
0.2.1

5 years ago

0.2.0

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago