use custom perf mark impl
This commit is contained in:
parent
e6304cbbf3
commit
e6bf344aec
|
@ -4639,11 +4639,6 @@
|
||||||
"object-visit": "1.0.1"
|
"object-visit": "1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"marky": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/marky/-/marky-1.2.0.tgz",
|
|
||||||
"integrity": "sha1-lhftZHu76o9F0ZUm2jPexwYG30I="
|
|
||||||
},
|
|
||||||
"math-expression-evaluator": {
|
"math-expression-evaluator": {
|
||||||
"version": "1.2.17",
|
"version": "1.2.17",
|
||||||
"resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz",
|
"resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz",
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
"intl-relativeformat": "^2.1.0",
|
"intl-relativeformat": "^2.1.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"lodash-webpack-plugin": "^0.11.4",
|
"lodash-webpack-plugin": "^0.11.4",
|
||||||
"marky": "^1.2.0",
|
|
||||||
"node-fetch": "^1.7.3",
|
"node-fetch": "^1.7.3",
|
||||||
"node-sass": "^4.7.2",
|
"node-sass": "^4.7.2",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
import { mark as markyMark, stop as markyStop } from 'marky'
|
|
||||||
import noop from 'lodash/noop'
|
import noop from 'lodash/noop'
|
||||||
|
|
||||||
const enableMarks = process.browser &&
|
const enableMarks = process.browser &&
|
||||||
|
performance.mark &&
|
||||||
(process.env.NODE_ENV !== 'production' ||
|
(process.env.NODE_ENV !== 'production' ||
|
||||||
new URLSearchParams(location.search).get('marks') === 'true')
|
new URLSearchParams(location.search).get('marks') === 'true')
|
||||||
|
|
||||||
const mark = enableMarks ? markyMark : noop
|
const perf = process.browser && performance
|
||||||
const stop = enableMarks ? markyStop : noop
|
|
||||||
|
function doMark(name) {
|
||||||
|
perf.mark(`start ${name}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function doStop(name) {
|
||||||
|
perf.mark(`end ${name}`)
|
||||||
|
perf.measure(name, `start ${name}`, `end ${name}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const mark = enableMarks ? doMark : noop
|
||||||
|
const stop = enableMarks ? doStop : noop
|
||||||
|
|
||||||
export {
|
export {
|
||||||
mark,
|
mark,
|
||||||
|
|
Loading…
Reference in New Issue