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

@bugsnag/browser-performance

Package Overview
Dependencies
Maintainers
9
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bugsnag/browser-performance - npm Package Compare versions

Comparing version 1.2.1-alpha.3 to 2.0.0

8

dist/auto-instrumentation/resource-load-plugin.js

@@ -83,3 +83,9 @@ function getHttpVersion(protocol) {

});
observer.observe({ type: 'resource', buffered: true });
try {
observer.observe({ type: 'resource', buffered: true });
}
catch (err) {
configuration.logger.warn('Unable to get previous resource loads as buffered observer not supported, only showing resource loads from this point on');
observer.observe({ entryTypes: ['resource'] });
}
}

@@ -86,0 +92,0 @@ }

31

dist/backgrounding-listener.js

@@ -1,3 +0,6 @@

function createBrowserBackgroundingListener(document) {
function createBrowserBackgroundingListener(window) {
const callbacks = [];
let state = window.document.visibilityState === 'hidden'
? 'in-background'
: 'in-foreground';
const backgroundingListener = {

@@ -7,15 +10,29 @@ onStateChange(backgroundingListenerCallback) {

// trigger the callback immediately if the document is already 'hidden'
if (document.visibilityState === 'hidden') {
backgroundingListenerCallback('in-background');
if (state === 'in-background') {
backgroundingListenerCallback(state);
}
}
};
document.addEventListener('visibilitychange', function () {
const state = document.visibilityState === 'hidden'
? 'in-background'
: 'in-foreground';
const backgroundStateChanged = (newState) => {
if (state === newState)
return;
state = newState;
for (const callback of callbacks) {
callback(state);
}
};
window.document.addEventListener('visibilitychange', function () {
const newState = window.document.visibilityState === 'hidden'
? 'in-background'
: 'in-foreground';
backgroundStateChanged(newState);
});
// some browsers don't fire the visibilitychange event when the page is suspended,
// so we also listen for pagehide and pageshow events
window.addEventListener('pagehide', function () {
backgroundStateChanged('in-background');
});
window.addEventListener('pageshow', function () {
backgroundStateChanged('in-foreground');
});
return backgroundingListener;

@@ -22,0 +39,0 @@ }

@@ -19,3 +19,3 @@ import { createClient, InMemoryQueue } from '@bugsnag/core-performance';

const backgroundingListener = createBrowserBackgroundingListener(document);
const backgroundingListener = createBrowserBackgroundingListener(window);
const spanAttributesSource = createSpanAttributesSource(document);

@@ -22,0 +22,0 @@ const clock = createClock(performance, backgroundingListener);

@@ -8,3 +8,3 @@ import cuid from '@bugsnag/cuid';

return function resourceAttributesSource(config) {
const attributes = new ResourceAttributes(config.releaseStage, config.appVersion, 'bugsnag.performance.browser', '1.2.1-alpha.3');
const attributes = new ResourceAttributes(config.releaseStage, config.appVersion, 'bugsnag.performance.browser', '2.0.0');
attributes.set('browser.user_agent', navigator.userAgent);

@@ -11,0 +11,0 @@ // chromium only

@@ -6,4 +6,8 @@ import { type BackgroundingListener } from '@bugsnag/core-performance';

}
export default function createBrowserBackgroundingListener(document: DocumentForVisibilityState): BackgroundingListener;
interface WindowWithDocumentForVisibilityState {
document: DocumentForVisibilityState;
addEventListener: (event: string, callback: () => void) => void;
}
export default function createBrowserBackgroundingListener(window: WindowWithDocumentForVisibilityState): BackgroundingListener;
export {};
//# sourceMappingURL=backgrounding-listener.d.ts.map
{
"name": "@bugsnag/browser-performance",
"version": "1.2.1-alpha.3",
"version": "2.0.0",
"description": "BugSnag performance monitoring for browsers",

@@ -24,6 +24,6 @@ "homepage": "https://www.bugsnag.com/",

"dependencies": {
"@bugsnag/core-performance": "^1.2.1-alpha.3",
"@bugsnag/core-performance": "^2.0.0",
"@bugsnag/cuid": "^3.0.2",
"@bugsnag/delivery-fetch-performance": "^1.2.1-alpha.3",
"@bugsnag/request-tracker-performance": "^1.2.1-alpha.3"
"@bugsnag/delivery-fetch-performance": "^2.0.0",
"@bugsnag/request-tracker-performance": "^2.0.0"
},

@@ -36,3 +36,3 @@ "type": "module",

],
"gitHead": "57660cefa40bed578bd44f8a03caa5971eb2ca5c"
"gitHead": "13ce6d677a070b56aeab48a3e284c3c5a5b94d2c"
}

Sorry, the diff of this file is not supported yet

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