0.1.4 • Published 9 years ago
prfnw v0.1.4
prfnw
CommonJS performance.now() wrapper to test your browsers
performance.now() > perf now > prfnw :)
Installation
$ npm install --save prfnw
Important
Using wrappers, console.log, options, etc. adds to overal performace. The quickest way would be:
var a = perfromance.now();
//...long process...
var b = perfromance.now() - a; // console.log(perfromance.now() - a);
Arguments
- name | required
- options | optional
Usage
var prfnw = require('prfnw');
prfnw('test #1');
//...long process...
prfnw('test #1', {/*options*/});
// -> test #1 666.3141592653590
console.log(prfnw.names); // -> { 'test #1': 666.3141592653590 }
Options
Second and next runs:
- forceDelete - delete value from first run, make another one | default: false
- keep - keep value after second run | default: false
- raw - return raw value | default: false
- log - custom log function | log: function(name, diff) { /**/ }
raw more iportant than log
Default log function
console.log(name, calc);
Requirements
console.log (Default log function) && performance.now
bad browsers:
// console.log
require('prfnw/patch/console.log');
// performance.now
require('prfnw/patch/performance.now');
ES6 version
copy (for now) prfnw-es6.js
file to your location and import it
import prfnw from './prfnw-es6'