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.7.1 to 1.7.3

6

cjs/transport.js

@@ -23,4 +23,3 @@ "use strict";

HttpRequest.prototype.send = function (data, size) {
var batchTime = new Date().getTime();
var url = this.withBatchTime ? this.endpointUrl + "&batch_time=" + batchTime : this.endpointUrl;
var url = this.withBatchTime ? addBatchTime(this.endpointUrl) : this.endpointUrl;
if (navigator.sendBeacon && size < this.bytesLimit) {

@@ -39,2 +38,5 @@ var isQueued = navigator.sendBeacon(url, data);

exports.HttpRequest = HttpRequest;
function addBatchTime(url) {
return "" + url + (url.indexOf('?') === -1 ? '?' : '&') + "batch_time=" + new Date().getTime();
}
var Batch = /** @class */ (function () {

@@ -41,0 +43,0 @@ function Batch(request, maxSize, bytesLimit, maxMessageSize, flushTimeout, contextProvider) {

@@ -40,3 +40,3 @@ "use strict";

if (checkURLSupported()) {
return new URL(url, base);
return base !== undefined ? new URL(url, base) : new URL(url);
}

@@ -64,4 +64,5 @@ if (base === undefined && !/:/.test(url)) {

try {
var url = new URL('http://test');
return url.href === 'http://test';
var url = new URL('http://test/path');
isURLSupported = url.href === 'http://test/path';
return isURLSupported;
}

@@ -68,0 +69,0 @@ catch (_a) {

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

export declare function getTimestamp(relativeTime: number): number;
export declare function getNavigationStart(): number;
export declare function objectValues(object: {

@@ -63,0 +64,0 @@ [key: string]: unknown;

@@ -170,9 +170,20 @@ "use strict";

function getRelativeTime(timestamp) {
return timestamp - performance.timing.navigationStart;
return timestamp - getNavigationStart();
}
exports.getRelativeTime = getRelativeTime;
function getTimestamp(relativeTime) {
return Math.floor(performance.timing.navigationStart + relativeTime);
return Math.floor(getNavigationStart() + relativeTime);
}
exports.getTimestamp = getTimestamp;
/**
* Navigation start slightly change on some rare cases
*/
var navigationStart;
function getNavigationStart() {
if (navigationStart === undefined) {
navigationStart = performance.timing.navigationStart;
}
return navigationStart;
}
exports.getNavigationStart = getNavigationStart;
function objectValues(object) {

@@ -179,0 +190,0 @@ var values = [];

@@ -20,4 +20,3 @@ import lodashMerge from 'lodash.merge';

HttpRequest.prototype.send = function (data, size) {
var batchTime = new Date().getTime();
var url = this.withBatchTime ? this.endpointUrl + "&batch_time=" + batchTime : this.endpointUrl;
var url = this.withBatchTime ? addBatchTime(this.endpointUrl) : this.endpointUrl;
if (navigator.sendBeacon && size < this.bytesLimit) {

@@ -36,2 +35,5 @@ var isQueued = navigator.sendBeacon(url, data);

export { HttpRequest };
function addBatchTime(url) {
return "" + url + (url.indexOf('?') === -1 ? '?' : '&') + "batch_time=" + new Date().getTime();
}
var Batch = /** @class */ (function () {

@@ -38,0 +40,0 @@ function Batch(request, maxSize, bytesLimit, maxMessageSize, flushTimeout, contextProvider) {

@@ -31,3 +31,3 @@ import { getLinkElementOrigin, getLocationOrigin } from './utils';

if (checkURLSupported()) {
return new URL(url, base);
return base !== undefined ? new URL(url, base) : new URL(url);
}

@@ -55,4 +55,5 @@ if (base === undefined && !/:/.test(url)) {

try {
var url = new URL('http://test');
return url.href === 'http://test';
var url = new URL('http://test/path');
isURLSupported = url.href === 'http://test/path';
return isURLSupported;
}

@@ -59,0 +60,0 @@ catch (_a) {

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

export declare function getTimestamp(relativeTime: number): number;
export declare function getNavigationStart(): number;
export declare function objectValues(object: {

@@ -63,0 +64,0 @@ [key: string]: unknown;

@@ -155,7 +155,17 @@ export var ONE_SECOND = 1000;

export function getRelativeTime(timestamp) {
return timestamp - performance.timing.navigationStart;
return timestamp - getNavigationStart();
}
export function getTimestamp(relativeTime) {
return Math.floor(performance.timing.navigationStart + relativeTime);
return Math.floor(getNavigationStart() + relativeTime);
}
/**
* Navigation start slightly change on some rare cases
*/
var navigationStart;
export function getNavigationStart() {
if (navigationStart === undefined) {
navigationStart = performance.timing.navigationStart;
}
return navigationStart;
}
export function objectValues(object) {

@@ -162,0 +172,0 @@ var values = [];

{
"name": "@datadog/browser-core",
"version": "1.7.1",
"version": "1.7.3",
"license": "Apache-2.0",

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

},
"gitHead": "3c877598f38f3745388ad2516416f0f064acaf78"
"gitHead": "d269e782b538bf1127cfef8887d9a1ee9bc4faca"
}

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

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