New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-perf-devtool

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-perf-devtool - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3-beta0

2

package.json
{
"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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc