Socket
Socket
Sign inDemoInstall

@datadog/browser-core

Package Overview
Dependencies
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-core - npm Package Compare versions

Comparing version 1.2.5 to 1.2.6

32

cjs/requestCollection.js

@@ -54,13 +54,2 @@ "use strict";

exports.trackXhr = trackXhr;
function getTraceId() {
// tslint:disable-next-line: no-unsafe-any
return 'ddtrace' in window && window.ddtrace.tracer.scope().active()
? // tslint:disable-next-line: no-unsafe-any
window.ddtrace.tracer
.scope()
.active()
.context()
.toTraceId()
: undefined;
}
function trackFetch(observable) {

@@ -92,2 +81,3 @@ if (!window.fetch) {

status: 0,
traceId: getTraceId(),
type: RequestType.FETCH,

@@ -109,2 +99,3 @@ });

status: response.status,
traceId: getTraceId(),
type: RequestType.FETCH,

@@ -135,2 +126,21 @@ });

exports.isServerError = isServerError;
/**
* Get the current traceId generated from dd-trace-js (if any).
*
* Note: in order to work, the browser-sdk should be initialized *before* dd-trace-js because both
* libraries are wrapping fetch() and XHR. Wrappers are called in reverse order, and the
* dd-trace-js wrapper needs to be called first so it can generate the new trace. The browser-sdk
* wrapper will then pick up the new trace id via this function.
*/
function getTraceId() {
// tslint:disable-next-line: no-unsafe-any
return 'ddtrace' in window && window.ddtrace.tracer.scope().active()
? // tslint:disable-next-line: no-unsafe-any
window.ddtrace.tracer
.scope()
.active()
.context()
.toTraceId()
: undefined;
}
//# sourceMappingURL=requestCollection.js.map

@@ -51,2 +51,9 @@ export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

export declare function isPercentage(value: unknown): boolean;
/**
* Get the time since the navigation was started.
*
* Note: this does not use `performance.timeOrigin` because it doesn't seem to reflect the actual
* time on which the navigation has started: it may be much farther in the past, at least in Firefox 71.
* Related issue in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1429926
*/
export declare function getRelativeTime(timestamp: number): number;

@@ -156,8 +156,13 @@ "use strict";

exports.isPercentage = isPercentage;
/**
* Get the time since the navigation was started.
*
* Note: this does not use `performance.timeOrigin` because it doesn't seem to reflect the actual
* time on which the navigation has started: it may be much farther in the past, at least in Firefox 71.
* Related issue in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1429926
*/
function getRelativeTime(timestamp) {
// performance.timeOrigin is undefined in WebKit, see https://bugs.webkit.org/show_bug.cgi?id=174862
var timeOrigin = performance.timeOrigin !== undefined ? performance.timeOrigin : performance.timing.navigationStart;
return timestamp - timeOrigin;
return timestamp - performance.timing.navigationStart;
}
exports.getRelativeTime = getRelativeTime;
//# sourceMappingURL=utils.js.map

@@ -50,13 +50,2 @@ import * as tslib_1 from "tslib";

}
function getTraceId() {
// tslint:disable-next-line: no-unsafe-any
return 'ddtrace' in window && window.ddtrace.tracer.scope().active()
? // tslint:disable-next-line: no-unsafe-any
window.ddtrace.tracer
.scope()
.active()
.context()
.toTraceId()
: undefined;
}
export function trackFetch(observable) {

@@ -88,2 +77,3 @@ if (!window.fetch) {

status: 0,
traceId: getTraceId(),
type: RequestType.FETCH,

@@ -105,2 +95,3 @@ });

status: response.status,
traceId: getTraceId(),
type: RequestType.FETCH,

@@ -127,2 +118,21 @@ });

}
/**
* Get the current traceId generated from dd-trace-js (if any).
*
* Note: in order to work, the browser-sdk should be initialized *before* dd-trace-js because both
* libraries are wrapping fetch() and XHR. Wrappers are called in reverse order, and the
* dd-trace-js wrapper needs to be called first so it can generate the new trace. The browser-sdk
* wrapper will then pick up the new trace id via this function.
*/
function getTraceId() {
// tslint:disable-next-line: no-unsafe-any
return 'ddtrace' in window && window.ddtrace.tracer.scope().active()
? // tslint:disable-next-line: no-unsafe-any
window.ddtrace.tracer
.scope()
.active()
.context()
.toTraceId()
: undefined;
}
//# sourceMappingURL=requestCollection.js.map

@@ -51,2 +51,9 @@ export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

export declare function isPercentage(value: unknown): boolean;
/**
* Get the time since the navigation was started.
*
* Note: this does not use `performance.timeOrigin` because it doesn't seem to reflect the actual
* time on which the navigation has started: it may be much farther in the past, at least in Firefox 71.
* Related issue in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1429926
*/
export declare function getRelativeTime(timestamp: number): number;

@@ -141,7 +141,12 @@ export var ONE_SECOND = 1000;

}
/**
* Get the time since the navigation was started.
*
* Note: this does not use `performance.timeOrigin` because it doesn't seem to reflect the actual
* time on which the navigation has started: it may be much farther in the past, at least in Firefox 71.
* Related issue in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1429926
*/
export function getRelativeTime(timestamp) {
// performance.timeOrigin is undefined in WebKit, see https://bugs.webkit.org/show_bug.cgi?id=174862
var timeOrigin = performance.timeOrigin !== undefined ? performance.timeOrigin : performance.timing.navigationStart;
return timestamp - timeOrigin;
return timestamp - performance.timing.navigationStart;
}
//# sourceMappingURL=utils.js.map
{
"name": "@datadog/browser-core",
"version": "1.2.5",
"version": "1.2.6",
"license": "Apache-2.0",

@@ -25,3 +25,3 @@ "main": "cjs/index.js",

},
"gitHead": "21b81ba06553184a61fd60348ce58ca85a14d57f"
"gitHead": "506edcf6a2bb4a5923aaace0e489e81bcaf7b25c"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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