Socket
Socket
Sign inDemoInstall

perf-marks

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

perf-marks - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

dist/cjs/is-performance-observable-supported.d.ts

44

CHANGELOG.md

@@ -10,2 +10,40 @@ # Change Log

## [1.8.0][] - 2020-02-16
### Added
- Adding new `isPerformanceObservableSupported` boolean for check if `PerformanceObservable` is supported for the current browser/NodeJS version
```js
import * as PerfMarks from 'perf-marks';
...
// Checking if `PerformanceObservable` is supported for the current browser/NodeJS version
if (PerfMarks.isPerformanceObservableSupported) {
try {
// If yes, start the PerformanceObserver
const observer: PerformanceObserver = new PerformanceObserver(list => {
// ... Do something
});
// register observer based on the entryTypes
// E.G. for long task notifications
observer.observe({ entryTypes: ['longtask'] });
} catch (e) {}
// ... Finishing the observer
observer.disconnect();
}
...
```
### Updated
- Updating jsdom to v16
- Updating lint-staged to v10.0.2
- Updating dev dependencies
### Fixed
- Migrating from `uglifyjs` to `uglify-js` due to package deprecation
## [1.7.0][] - 2020-01-18

@@ -171,5 +209,7 @@

[1.6.0]: https://github.com/willmendesneto/perf-marks/tree/v1.6.0
[unreleased]: https://github.com/willmendesneto/perf-marks/compare/v1.7.0...HEAD
[1.7.0]: https://github.com/willmendesneto/perf-marks/tree/v1.7.0
[Unreleased]: https://github.com/willmendesneto/perf-marks/compare/v1.7.0...HEAD
[1.7.0]: https://github.com/willmendesneto/perf-marks/tree/v1.7.0
[Unreleased]: https://github.com/willmendesneto/perf-marks/compare/v1.8.0...HEAD
[1.8.0]: https://github.com/willmendesneto/perf-marks/tree/v1.8.0
export * from './marks';
export * from './entries';
export * from './is-user-timing-api-supported';
export * from './is-performance-observable-supported';

@@ -7,1 +7,2 @@ "use strict";

tslib_1.__exportStar(require("./is-user-timing-api-supported"), exports);
tslib_1.__exportStar(require("./is-performance-observable-supported"), exports);

3

dist/cjs/marks.d.ts
import { isUserTimingAPISupported } from './is-user-timing-api-supported';
import { isPerformanceObservableSupported } from './is-performance-observable-supported';
/**

@@ -46,2 +47,2 @@ * Clear marks and measure of performance event

declare const clearAll: () => void;
export { start, end, clear, clearAll, isUserTimingAPISupported };
export { start, end, clear, clearAll, isUserTimingAPISupported, isPerformanceObservableSupported };

@@ -5,2 +5,4 @@ "use strict";

exports.isUserTimingAPISupported = is_user_timing_api_supported_1.isUserTimingAPISupported;
var is_performance_observable_supported_1 = require("./is-performance-observable-supported");
exports.isPerformanceObservableSupported = is_performance_observable_supported_1.isPerformanceObservableSupported;
// Map() is not used in order to decrease the bundle

@@ -7,0 +9,0 @@ var marksMap = {};

export * from './marks';
export * from './entries';
export * from './is-user-timing-api-supported';
export * from './is-performance-observable-supported';
export * from './marks';
export * from './entries';
export * from './is-user-timing-api-supported';
export * from './is-performance-observable-supported';
import { isUserTimingAPISupported } from './is-user-timing-api-supported';
import { isPerformanceObservableSupported } from './is-performance-observable-supported';
/**

@@ -46,2 +47,2 @@ * Clear marks and measure of performance event

declare const clearAll: () => void;
export { start, end, clear, clearAll, isUserTimingAPISupported };
export { start, end, clear, clearAll, isUserTimingAPISupported, isPerformanceObservableSupported };
import { isUserTimingAPISupported } from './is-user-timing-api-supported';
import { isPerformanceObservableSupported } from './is-performance-observable-supported';
// Map() is not used in order to decrease the bundle

@@ -92,2 +93,2 @@ let marksMap = {};

};
export { start, end, clear, clearAll, isUserTimingAPISupported };
export { start, end, clear, clearAll, isUserTimingAPISupported, isPerformanceObservableSupported };
export * from './marks';
export * from './entries';
export * from './is-user-timing-api-supported';
export * from './is-performance-observable-supported';
export * from './marks';
export * from './entries';
export * from './is-user-timing-api-supported';
export * from './is-performance-observable-supported';
import { isUserTimingAPISupported } from './is-user-timing-api-supported';
import { isPerformanceObservableSupported } from './is-performance-observable-supported';
/**

@@ -46,2 +47,2 @@ * Clear marks and measure of performance event

declare const clearAll: () => void;
export { start, end, clear, clearAll, isUserTimingAPISupported };
export { start, end, clear, clearAll, isUserTimingAPISupported, isPerformanceObservableSupported };
import { isUserTimingAPISupported } from './is-user-timing-api-supported';
import { isPerformanceObservableSupported } from './is-performance-observable-supported';
// Map() is not used in order to decrease the bundle

@@ -92,2 +93,2 @@ var marksMap = {};

};
export { start, end, clear, clearAll, isUserTimingAPISupported };
export { start, end, clear, clearAll, isUserTimingAPISupported, isPerformanceObservableSupported };

@@ -21,2 +21,13 @@ (function (global, factory) {

/**
* Boolean with the result of the check if PerformanceObservable
* is supported for the current browser/NodeJS version
*
* @returns boolean
*
*/
var isPerformanceObservableSupported = typeof PerformanceObserver !== 'undefined' &&
typeof PerformanceObserver.prototype !== 'undefined' &&
typeof PerformanceObserver.prototype.constructor === 'function';
// Map() is not used in order to decrease the bundle

@@ -140,2 +151,3 @@ var marksMap = {};

exports.getNavigationMarker = getNavigationMarker;
exports.isPerformanceObservableSupported = isPerformanceObservableSupported;
exports.isUserTimingAPISupported = isUserTimingAPISupported;

@@ -142,0 +154,0 @@ exports.start = start;

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).PerfMarks={})}(this,function(e){"use strict";function o(){return a?performance.now():Date.now()}function t(e){f[e]=void 0,a&&(performance.clearMeasures(e),performance.clearMarks(e))}function r(e){return a&&performance.getEntriesByType(e)||[]}var a="undefined"!=typeof performance&&void 0!==performance.now&&"function"==typeof performance.mark&&"function"==typeof performance.clearMarks&&"function"==typeof performance.measure&&"function"==typeof performance.clearMeasures,f={};e.clear=t,e.clearAll=function(){f={},a&&(performance.clearMeasures(),performance.clearMarks())},e.end=function(e,r){try{var n=f[e];return a?(performance.measure(e,e,r||void 0),performance.getEntriesByName(e).pop()||{}):n?{duration:o()-n,startTime:n}:{}}catch(e){return{}}finally{t(e)}},e.getEntriesByType=r,e.getNavigationMarker=function(){return r("navigation").pop()||{}},e.isUserTimingAPISupported=a,e.start=function(e){a&&performance.mark(e),f[e]=o()},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).PerfMarks={})}(this,function(e){"use strict";function o(){return a?performance.now():Date.now()}function t(e){f[e]=void 0,a&&(performance.clearMeasures(e),performance.clearMarks(e))}function r(e){return a&&performance.getEntriesByType(e)||[]}var a="undefined"!=typeof performance&&void 0!==performance.now&&"function"==typeof performance.mark&&"function"==typeof performance.clearMarks&&"function"==typeof performance.measure&&"function"==typeof performance.clearMeasures,n="undefined"!=typeof PerformanceObserver&&void 0!==PerformanceObserver.prototype&&"function"==typeof PerformanceObserver.prototype.constructor,f={};e.clear=t,e.clearAll=function(){f={},a&&(performance.clearMeasures(),performance.clearMarks())},e.end=function(e,r){try{var n=f[e];return a?(performance.measure(e,e,r||void 0),performance.getEntriesByName(e).pop()||{}):n?{duration:o()-n,startTime:n}:{}}catch(e){return{}}finally{t(e)}},e.getEntriesByType=r,e.getNavigationMarker=function(){return r("navigation").pop()||{}},e.isPerformanceObservableSupported=n,e.isUserTimingAPISupported=a,e.start=function(e){a&&performance.mark(e),f[e]=o()},Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "perf-marks",
"version": "1.7.0",
"version": "1.8.0",
"author": "Will Mendes <willmendesneto@gmail.com>",

@@ -30,6 +30,6 @@ "description": "The simplest and lightweight solution for User Timing API in Javascript.",

"devDependencies": {
"@types/jest": "^24.0.18",
"@types/node": "^13.1.0",
"@typescript-eslint/eslint-plugin": "^2.3.3",
"@typescript-eslint/parser": "^2.3.3",
"@types/jest": "^25.1.2",
"@types/node": "^13.7.1",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
"bundlesize": "^0.18.0",

@@ -39,3 +39,3 @@ "changelog-verify": "^1.1.0",

"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-compat": "^3.3.0",

@@ -45,13 +45,13 @@ "eslint-plugin-prettier": "^3.1.1",

"glob": "^7.1.4",
"husky": "^4.0.2",
"jest": "^24.9.0",
"jsdom": "^15.2.0",
"lint-staged": "^9.4.2",
"husky": "^4.2.3",
"jest": "^25.1.0",
"jsdom": "^16.1.0",
"lint-staged": "^10.0.7",
"prettier": "^1.18.2",
"rollup": "^1.26.3",
"ts-jest": "^24.1.0",
"rollup": "^1.31.1",
"ts-jest": "^25.2.0",
"ts-node": "^8.4.1",
"typescript": "^3.4.3",
"typings": "^2.1.1",
"uglifyjs": "^2.4.11",
"uglify-js": "^3.7.7",
"usertiming": "^0.1.8",

@@ -84,19 +84,19 @@ "version-changelog": "^3.1.0"

"path": "./dist/esm/index.js",
"maxSize": "84B"
"maxSize": "104B"
},
{
"path": "./dist/es2015/index.js",
"maxSize": "84B"
"maxSize": "104B"
},
{
"path": "./dist/cjs/index.js",
"maxSize": "176B"
"maxSize": "193B"
},
{
"path": "./dist/umd/perf-marks.js",
"maxSize": "1.19KB"
"maxSize": "1.24KB"
},
{
"path": "./dist/umd/perf-marks.min.js",
"maxSize": "508B"
"maxSize": "554B"
}

@@ -103,0 +103,0 @@ ],

@@ -18,4 +18,8 @@ # Perf-marks

The simplest and lightweight solution for [User Timing API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API) in Javascript. Simple how it should be.
### Why perf-marks?
That's the simplest and lightweight solution for [User Timing API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API) in Javascript. Simple how it should be.
You can find more details about it in the slides "[User Timing API: because performance matters](http://bit.ly/user-timing-api-because-perf-matters)"
## Contributing

@@ -200,2 +204,30 @@

### `PerfMarks.isPerformanceObservableSupported`
Boolean with the result of the check if PerformanceObservable is supported for the current browser/NodeJS version.
> `PerfMarks` does not provide a fallback if `PerformanceObservable` is not supported. This boolean is exposed in case the app needs to check the case to use any other mechanism.
```js
import * as PerfMarks from 'perf-marks';
...
// Checking if `PerformanceObservable` is supported for the current browser/NodeJS version
if (PerfMarks.isPerformanceObservableSupported) {
try {
// If yes, start the PerformanceObserver
const observer: PerformanceObserver = new PerformanceObserver(list => {
// ... Do something
});
// register observer based on the entryTypes
// E.G. for long task notifications
observer.observe({ entryTypes: ['longtask'] });
} catch (e) {}
// ... Finishing the observer
observer.disconnect();
}
...
```
## Entrypoints

@@ -215,2 +247,3 @@

- `isUserTimingAPISupported`
- `isPerformanceObservableSupported`
- `perf-marks/entries`: it has all the methods to get entries

@@ -217,0 +250,0 @@ - `getNavigationMarker`

Sorry, the diff of this file is not supported yet

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