marky
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -5,2 +5,5 @@ var marky = (function (exports) { | ||
/* global performance */ | ||
// TODO: Node's built-in performance API has poor performance for getEntriesByName() | ||
// so currently we avoid it: https://github.com/nolanlawson/marky/issues/29 | ||
var perf = typeof performance !== 'undefined' && performance; | ||
@@ -7,0 +10,0 @@ |
@@ -6,2 +6,5 @@ 'use strict'; | ||
/* global performance */ | ||
// TODO: Node's built-in performance API has poor performance for getEntriesByName() | ||
// so currently we avoid it: https://github.com/nolanlawson/marky/issues/29 | ||
var perf = typeof performance !== 'undefined' && performance; | ||
@@ -8,0 +11,0 @@ |
/* global performance */ | ||
// TODO: Node's built-in performance API has poor performance for getEntriesByName() | ||
// so currently we avoid it: https://github.com/nolanlawson/marky/issues/29 | ||
var perf = typeof performance !== 'undefined' && performance; | ||
@@ -3,0 +6,0 @@ |
@@ -5,5 +5,2 @@ 'use strict'; | ||
/* global performance */ | ||
var perf = typeof performance !== 'undefined' && performance; | ||
var nowForNode; | ||
@@ -52,26 +49,3 @@ | ||
if ( | ||
perf && | ||
perf.mark && | ||
perf.getEntriesByName && | ||
perf.getEntriesByType && | ||
perf.clearMeasures | ||
) { | ||
exports.mark = function (name) { | ||
throwIfEmpty(name); | ||
perf.mark(("start " + name)); | ||
}; | ||
exports.stop = function (name) { | ||
throwIfEmpty(name); | ||
perf.mark(("end " + name)); | ||
perf.measure(name, ("start " + name), ("end " + name)); | ||
var entries = perf.getEntriesByName(name); | ||
return entries[entries.length - 1] | ||
}; | ||
exports.getEntries = function () { return perf.getEntriesByType('measure'); }; | ||
exports.clear = function () { | ||
perf.clearMarks(); | ||
perf.clearMeasures(); | ||
}; | ||
} else { | ||
{ | ||
var marks = {}; | ||
@@ -78,0 +52,0 @@ var entries = []; |
@@ -1,4 +0,1 @@ | ||
/* global performance */ | ||
var perf = typeof performance !== 'undefined' && performance; | ||
var nowForNode; | ||
@@ -47,26 +44,3 @@ | ||
if ( | ||
perf && | ||
perf.mark && | ||
perf.getEntriesByName && | ||
perf.getEntriesByType && | ||
perf.clearMeasures | ||
) { | ||
mark = function (name) { | ||
throwIfEmpty(name); | ||
perf.mark(("start " + name)); | ||
}; | ||
stop = function (name) { | ||
throwIfEmpty(name); | ||
perf.mark(("end " + name)); | ||
perf.measure(name, ("start " + name), ("end " + name)); | ||
var entries = perf.getEntriesByName(name); | ||
return entries[entries.length - 1] | ||
}; | ||
getEntries = function () { return perf.getEntriesByType('measure'); }; | ||
clear = function () { | ||
perf.clearMarks(); | ||
perf.clearMeasures(); | ||
}; | ||
} else { | ||
{ | ||
var marks = {}; | ||
@@ -73,0 +47,0 @@ var entries = []; |
{ | ||
"name": "marky", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Performance timer based on performance.mark() and measure()", | ||
@@ -74,3 +74,7 @@ "main": "lib/marky.cjs.js", | ||
}, | ||
"homepage": "https://github.com/nolanlawson/marky#readme" | ||
"homepage": "https://github.com/nolanlawson/marky#readme", | ||
"volta": { | ||
"node": "16.14.0", | ||
"yarn": "1.22.17" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
marky [![Build status](https://circleci.com/gh/nolanlawson/marky.svg?style=svg)](https://app.circleci.com/pipelines/gh/nolanlawson/marky) | ||
marky | ||
====== | ||
@@ -47,3 +47,3 @@ | ||
This is because `marky` adds standard | ||
[PerformanceEntries](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry) to the [Performance Timeline](https://developer.mozilla.org/en-US/docs/Web/API/Performance_Timeline). Tools like [WebPageTest](http://blog.patrickmeenan.com/2013/07/measuring-performance-of-user-experience.html) and [Windows Performance Analyzer](https://blogs.windows.com/msedgedev/2016/05/11/top-down-analysis-wpt/) also surface them, and you can even [send them to your analytics provider](https://codelabs.developers.google.com/codelabs/performance-analytics/index.html). | ||
[PerformanceEntries](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry) to the [Performance Timeline](https://developer.mozilla.org/en-US/docs/Web/API/Performance_Timeline). Tools like [WebPageTest](http://blog.patrickmeenan.com/2013/07/measuring-performance-of-user-experience.html) and [Windows Performance Analyzer](https://blogs.windows.com/msedgedev/2016/05/11/top-down-analysis-wpt/) also surface them, and you can even [send them to your analytics provider](https://github.com/googlecodelabs/performance-analytics). | ||
@@ -50,0 +50,0 @@ API |
30234
409