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.10.0 to 1.11.1

2

cjs/sessionManagement.js

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

}
}, cookie_1.COOKIE_ACCESS_DELAY);
}, cookie_1.COOKIE_ACCESS_DELAY).throttled;
var expandSession = function () {

@@ -39,0 +39,0 @@ var session = retrieveActiveSession(sessionCookie);

@@ -24,3 +24,3 @@ import { Context } from './utils';

private contextProvider;
private beforeFlushOnUnloadHandlers;
private beforeUnloadCallback;
private pushOnlyBuffer;

@@ -30,6 +30,5 @@ private upsertBuffer;

private bufferMessageCount;
constructor(request: HttpRequest, maxSize: number, bytesLimit: number, maxMessageSize: number, flushTimeout: number, contextProvider: () => Context);
constructor(request: HttpRequest, maxSize: number, bytesLimit: number, maxMessageSize: number, flushTimeout: number, contextProvider: () => Context, beforeUnloadCallback?: () => void);
add(message: T): void;
upsert(message: T, key: string): void;
beforeFlushOnUnload(handler: () => void): void;
flush(): void;

@@ -36,0 +35,0 @@ private addOrUpdate;

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

var Batch = /** @class */ (function () {
function Batch(request, maxSize, bytesLimit, maxMessageSize, flushTimeout, contextProvider) {
function Batch(request, maxSize, bytesLimit, maxMessageSize, flushTimeout, contextProvider, beforeUnloadCallback) {
if (beforeUnloadCallback === void 0) { beforeUnloadCallback = utils_1.noop; }
this.request = request;

@@ -49,3 +50,3 @@ this.maxSize = maxSize;

this.contextProvider = contextProvider;
this.beforeFlushOnUnloadHandlers = [];
this.beforeUnloadCallback = beforeUnloadCallback;
this.pushOnlyBuffer = [];

@@ -64,5 +65,2 @@ this.upsertBuffer = {};

};
Batch.prototype.beforeFlushOnUnload = function (handler) {
this.beforeFlushOnUnloadHandlers.push(handler);
};
Batch.prototype.flush = function () {

@@ -158,5 +156,3 @@ if (this.bufferMessageCount !== 0) {

*/
window.addEventListener(utils_1.DOM_EVENT.BEFORE_UNLOAD, internalMonitoring_1.monitor(function () {
_this.beforeFlushOnUnloadHandlers.forEach(function (handler) { return handler(); });
}));
window.addEventListener(utils_1.DOM_EVENT.BEFORE_UNLOAD, internalMonitoring_1.monitor(this.beforeUnloadCallback));
/**

@@ -163,0 +159,0 @@ * Only event that guarantee to fire on mobile devices when the page transitions to background state

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

trailing?: boolean;
}): () => void;
}): {
throttled: () => void;
stop: () => void;
};
/**

@@ -34,0 +37,0 @@ * UUID v4

@@ -37,22 +37,33 @@ "use strict";

var hasPendingExecution = false;
return function () {
var _this = this;
if (inWaitPeriod) {
hasPendingExecution = true;
return;
}
if (needLeadingExecution) {
fn.apply(this);
}
else {
hasPendingExecution = true;
}
inWaitPeriod = true;
setTimeout(function () {
if (needTrailingExecution && hasPendingExecution) {
fn.apply(_this);
var pendingTimeoutId;
var isStopped = false;
return {
throttled: function () {
var _this = this;
if (isStopped) {
return;
}
inWaitPeriod = false;
hasPendingExecution = false;
}, wait);
if (inWaitPeriod) {
hasPendingExecution = true;
return;
}
if (needLeadingExecution) {
fn.apply(this);
}
else {
hasPendingExecution = true;
}
inWaitPeriod = true;
pendingTimeoutId = window.setTimeout(function () {
if (needTrailingExecution && hasPendingExecution) {
fn.apply(_this);
}
inWaitPeriod = false;
hasPendingExecution = false;
}, wait);
},
stop: function () {
window.clearTimeout(pendingTimeoutId);
isStopped = true;
},
};

@@ -59,0 +70,0 @@ }

@@ -33,3 +33,3 @@ import { cacheCookieAccess, COOKIE_ACCESS_DELAY } from './cookie';

}
}, COOKIE_ACCESS_DELAY);
}, COOKIE_ACCESS_DELAY).throttled;
var expandSession = function () {

@@ -36,0 +36,0 @@ var session = retrieveActiveSession(sessionCookie);

@@ -24,3 +24,3 @@ import { Context } from './utils';

private contextProvider;
private beforeFlushOnUnloadHandlers;
private beforeUnloadCallback;
private pushOnlyBuffer;

@@ -30,6 +30,5 @@ private upsertBuffer;

private bufferMessageCount;
constructor(request: HttpRequest, maxSize: number, bytesLimit: number, maxMessageSize: number, flushTimeout: number, contextProvider: () => Context);
constructor(request: HttpRequest, maxSize: number, bytesLimit: number, maxMessageSize: number, flushTimeout: number, contextProvider: () => Context, beforeUnloadCallback?: () => void);
add(message: T): void;
upsert(message: T, key: string): void;
beforeFlushOnUnload(handler: () => void): void;
flush(): void;

@@ -36,0 +35,0 @@ private addOrUpdate;

import { __spreadArrays } from "tslib";
import lodashMerge from 'lodash.merge';
import { monitor } from './internalMonitoring';
import { DOM_EVENT, jsonStringify, objectValues } from './utils';
import { DOM_EVENT, jsonStringify, noop, objectValues } from './utils';
/**

@@ -39,3 +39,4 @@ * Use POST request without content type to:

var Batch = /** @class */ (function () {
function Batch(request, maxSize, bytesLimit, maxMessageSize, flushTimeout, contextProvider) {
function Batch(request, maxSize, bytesLimit, maxMessageSize, flushTimeout, contextProvider, beforeUnloadCallback) {
if (beforeUnloadCallback === void 0) { beforeUnloadCallback = noop; }
this.request = request;

@@ -47,3 +48,3 @@ this.maxSize = maxSize;

this.contextProvider = contextProvider;
this.beforeFlushOnUnloadHandlers = [];
this.beforeUnloadCallback = beforeUnloadCallback;
this.pushOnlyBuffer = [];

@@ -62,5 +63,2 @@ this.upsertBuffer = {};

};
Batch.prototype.beforeFlushOnUnload = function (handler) {
this.beforeFlushOnUnloadHandlers.push(handler);
};
Batch.prototype.flush = function () {

@@ -156,5 +154,3 @@ if (this.bufferMessageCount !== 0) {

*/
window.addEventListener(DOM_EVENT.BEFORE_UNLOAD, monitor(function () {
_this.beforeFlushOnUnloadHandlers.forEach(function (handler) { return handler(); });
}));
window.addEventListener(DOM_EVENT.BEFORE_UNLOAD, monitor(this.beforeUnloadCallback));
/**

@@ -161,0 +157,0 @@ * Only event that guarantee to fire on mobile devices when the page transitions to background state

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

trailing?: boolean;
}): () => void;
}): {
throttled: () => void;
stop: () => void;
};
/**

@@ -34,0 +37,0 @@ * UUID v4

@@ -35,22 +35,33 @@ export var ONE_SECOND = 1000;

var hasPendingExecution = false;
return function () {
var _this = this;
if (inWaitPeriod) {
hasPendingExecution = true;
return;
}
if (needLeadingExecution) {
fn.apply(this);
}
else {
hasPendingExecution = true;
}
inWaitPeriod = true;
setTimeout(function () {
if (needTrailingExecution && hasPendingExecution) {
fn.apply(_this);
var pendingTimeoutId;
var isStopped = false;
return {
throttled: function () {
var _this = this;
if (isStopped) {
return;
}
inWaitPeriod = false;
hasPendingExecution = false;
}, wait);
if (inWaitPeriod) {
hasPendingExecution = true;
return;
}
if (needLeadingExecution) {
fn.apply(this);
}
else {
hasPendingExecution = true;
}
inWaitPeriod = true;
pendingTimeoutId = window.setTimeout(function () {
if (needTrailingExecution && hasPendingExecution) {
fn.apply(_this);
}
inWaitPeriod = false;
hasPendingExecution = false;
}, wait);
},
stop: function () {
window.clearTimeout(pendingTimeoutId);
isStopped = true;
},
};

@@ -57,0 +68,0 @@ }

{
"name": "@datadog/browser-core",
"version": "1.10.0",
"version": "1.11.1",
"license": "Apache-2.0",

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

},
"gitHead": "bbe113b3206ebd5f18b9a0f14ec1f1577a91b0f5"
"gitHead": "e830e0bef74d1e30585a03ff032b0bba7bb8364d"
}

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