Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/performance

Package Overview
Dependencies
Maintainers
12
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/performance - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

6

CHANGELOG.md

@@ -10,2 +10,8 @@ # Changelog

## [1.0.3] - 2019-01-11
### Fixed
- Fixed an issue where browsers supporting some custom timing types (but not `PerformanceObserver`) would throw while trying to create an instance of `PerformanceObserver`
## [1.0.2] - 2019-01-11

@@ -12,0 +18,0 @@

1

dist/performance.d.ts

@@ -9,2 +9,3 @@ import { Navigation } from './navigation';

export declare class Performance {
readonly supportsObserver: boolean;
readonly supportsMarks: boolean;

@@ -11,0 +12,0 @@ readonly supportsNavigationEntries: boolean;

@@ -12,2 +12,3 @@ "use strict";

var _this = this;
this.supportsObserver = utilities_1.hasGlobal('PerformanceObserver');
this.supportsMarks = utilities_1.hasGlobal('PerformanceMark');

@@ -14,0 +15,0 @@ this.supportsNavigationEntries = utilities_1.hasGlobal('PerformanceNavigationTiming');

29

dist/utilities.js

@@ -21,11 +21,22 @@ "use strict";

function withEntriesOfType(type, handler) {
var initialEntries = performance.getEntriesByType(type);
initialEntries.forEach(function (entry) { return handler(entry); });
var observer = new PerformanceObserver(function (entries) {
entries.getEntriesByType(type).forEach(function (entry) { return handler(entry); });
});
observer.observe({
entryTypes: [type],
buffered: true,
});
try {
var initialEntries = performance.getEntriesByType(type);
initialEntries.forEach(function (entry) { return handler(entry); });
if (!hasGlobal('PerformanceObserver')) {
return;
}
var observer = new PerformanceObserver(function (entries) {
entries.getEntriesByType(type).forEach(function (entry) { return handler(entry); });
});
observer.observe({
entryTypes: [type],
buffered: true,
});
}
catch (error) {
// Browser support here is weird. Some browsers support getting
// the initial entries, but don't support performance observers.
// Some throw errors when invalid types are passed, others don't.
// We're being very protective here, but I think it's the only way.
}
}

@@ -32,0 +43,0 @@ exports.withEntriesOfType = withEntriesOfType;

{
"name": "@shopify/performance",
"version": "1.0.2",
"version": "1.0.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Primitives for collecting browser performance metrics.",

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