react-perf-devtool
Advanced tools
Comparing version 3.0.4 to 3.0.5
@@ -45,29 +45,32 @@ 'use strict'; | ||
var _params = params, | ||
shouldLog = _params.shouldLog, | ||
port = _params.port, | ||
components = _params.components; | ||
// TODO: Is there any way to polyfill this API ? | ||
if (window.PerformanceObserver) { | ||
var _params = params, | ||
shouldLog = _params.shouldLog, | ||
port = _params.port, | ||
components = _params.components; | ||
var observer = new window.PerformanceObserver(function (list) { | ||
var measures = (0, _generate.generateDataFromMeasures)((0, _parse.getReactPerformanceData)(list.getEntries())); | ||
var observer = new window.PerformanceObserver(function (list) { | ||
var measures = (0, _generate.generateDataFromMeasures)((0, _parse.getReactPerformanceData)(list.getEntries())); | ||
if (callback && typeof callback === 'function') { | ||
callback(measures); | ||
} | ||
if (callback && typeof callback === 'function') { | ||
callback(measures); | ||
} | ||
window.__REACT_PERF_DEVTOOL_GLOBAL_STORE__ = { | ||
measures: measures, | ||
length: list.getEntries().length, | ||
rawMeasures: list.getEntries() | ||
window.__REACT_PERF_DEVTOOL_GLOBAL_STORE__ = { | ||
measures: measures, | ||
length: list.getEntries().length, | ||
rawMeasures: list.getEntries() | ||
// For logging to console | ||
};if (shouldLog) { | ||
logToConsole(params, measures); | ||
} | ||
}); | ||
// For logging to console | ||
};if (shouldLog) { | ||
logToConsole(params, measures); | ||
} | ||
}); | ||
observer.observe({ | ||
entryTypes: ['measure'] | ||
}); | ||
observer.observe({ | ||
entryTypes: ['measure'] | ||
}); | ||
} | ||
}; | ||
@@ -74,0 +77,0 @@ |
{ | ||
"name": "react-perf-devtool", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "A devtool for inspecting the performance of React Components", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,2 +6,3 @@ # React Performance Devtool | ||
![Author](https://img.shields.io/badge/author-Nitin%20Tulswani-lightgrey.svg) | ||
![current-version](https://img.shields.io/badge/version-3.0.5-blue.svg) | ||
@@ -112,5 +113,4 @@ > A devtool for inspecting the performance of React Components | ||
```js | ||
var registerObserver = require('react-perf-devtool') | ||
const { registerObserver } = require('react-perf-devtool') | ||
// Simple, no? | ||
registerObserver() | ||
@@ -140,3 +140,3 @@ ``` | ||
```js | ||
const registerObserver = require('react-perf-devtool') | ||
const { registerObserver } = require('react-perf-devtool') | ||
@@ -191,9 +191,9 @@ function callback(measures) { | ||
var React = require('react') | ||
var ReactDOM = require('react-dom') | ||
var registerObserver = require('react-perf-devtool') | ||
const React = require('react') | ||
const ReactDOM = require('react-dom') | ||
const { registerObserver } = require('react-perf-devtool') | ||
var Component = require('./Component') // Some React Component | ||
const Component = require('./Component') // Some React Component | ||
var options = { | ||
const options = { | ||
shouldLog: true, | ||
@@ -214,3 +214,3 @@ port: 8080 | ||
// server.js | ||
var { json } = require('micro') | ||
const { json } = require('micro') | ||
@@ -314,3 +314,3 @@ module.exports = async req => { | ||
```js | ||
var options = { | ||
const options = { | ||
shouldLog: true, | ||
@@ -400,3 +400,3 @@ port: 3000, | ||
```js | ||
const registerObserver = require('react-perf-devtool') | ||
const { registerObserver } = require('react-perf-devtool') | ||
@@ -403,0 +403,0 @@ registerObserver() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41234
594
0