react-perf-devtool
Advanced tools
Comparing version 3.0.2 to 3.0.3-beta0
{ | ||
"name": "react-perf-devtool", | ||
"version": "3.0.2", | ||
"version": "3.0.3-beta0", | ||
"description": "A devtool for inspecting the performance of React Components", | ||
@@ -5,0 +5,0 @@ "main": "src/npm/index.js", |
@@ -93,2 +93,4 @@ # React Performance Devtool | ||
> This extension and package also depends on react. Please make sure you have those installed as well. | ||
> Note - The npm module is important and required to use the devtool. So make sure you've installed it before using the browser extension. | ||
@@ -95,0 +97,0 @@ |
@@ -52,3 +52,3 @@ var getReactPerformanceData = require('../shared/parse') | ||
if (shouldLog) { | ||
logToConsole(port, measures) | ||
logToConsole(params, measures) | ||
} | ||
@@ -66,25 +66,9 @@ }) | ||
*/ | ||
function logToConsole(port, measures) { | ||
measures.forEach( | ||
({ | ||
componentName, | ||
mount, | ||
render, | ||
update, | ||
unmount, | ||
totalTimeSpent, | ||
percentTimeSpent, | ||
numberOfInstances, | ||
componentWillMount, | ||
componentDidMount, | ||
componentWillReceiveProps, | ||
shouldComponentUpdate, | ||
componentWillUpdate, | ||
componentDidUpdate, | ||
componentWillUnmount | ||
}) => { | ||
// The time is in millisecond (ms) | ||
// TODO: The data generated is generalized. Make it concrete! | ||
const data = { | ||
component: componentName, | ||
function logToConsole({ port, components }, measures) { | ||
if (typeof components !== undefined) { | ||
var stats = getRequiredMeasures(components, measures) | ||
stats.forEach( | ||
({ | ||
componentName, | ||
mount, | ||
@@ -104,7 +88,69 @@ render, | ||
componentWillUnmount | ||
}) => { | ||
// The time is in millisecond (ms) | ||
// TODO: The data generated is generalized. Make it concrete! | ||
const data = { | ||
component: componentName, | ||
mount, | ||
render, | ||
update, | ||
unmount, | ||
totalTimeSpent, | ||
percentTimeSpent, | ||
numberOfInstances, | ||
componentWillMount, | ||
componentDidMount, | ||
componentWillReceiveProps, | ||
shouldComponentUpdate, | ||
componentWillUpdate, | ||
componentDidUpdate, | ||
componentWillUnmount | ||
} | ||
send(data, port) | ||
} | ||
) | ||
} else { | ||
measures.forEach( | ||
({ | ||
componentName, | ||
mount, | ||
render, | ||
update, | ||
unmount, | ||
totalTimeSpent, | ||
percentTimeSpent, | ||
numberOfInstances, | ||
componentWillMount, | ||
componentDidMount, | ||
componentWillReceiveProps, | ||
shouldComponentUpdate, | ||
componentWillUpdate, | ||
componentDidUpdate, | ||
componentWillUnmount | ||
}) => { | ||
// The time is in millisecond (ms) | ||
// TODO: The data generated is generalized. Make it concrete! | ||
const data = { | ||
component: componentName, | ||
mount, | ||
render, | ||
update, | ||
unmount, | ||
totalTimeSpent, | ||
percentTimeSpent, | ||
numberOfInstances, | ||
componentWillMount, | ||
componentDidMount, | ||
componentWillReceiveProps, | ||
shouldComponentUpdate, | ||
componentWillUpdate, | ||
componentDidUpdate, | ||
componentWillUnmount | ||
} | ||
send(data, port) | ||
} | ||
) | ||
send(data, port) | ||
} | ||
) | ||
} | ||
} | ||
@@ -122,2 +168,20 @@ | ||
// getRequiredComponents(['App', 'Messages'], [{ componentName: 'App', ...}, { componentName: 'Post', ...}, { componentName: 'Messages', ...}]) | ||
function getRequiredMeasures(components, measures) { | ||
var requiredMeasures = [] | ||
if (!Array.isArray(components)) { | ||
components = [components] | ||
} | ||
measures.forEach(measure => { | ||
if (components.includes(measure.componentName)) { | ||
requiredMeasures.push(measure) | ||
} | ||
}) | ||
return requiredMeasures | ||
} | ||
module.exports = registerObserver |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
59868
911
385
2