Socket
Socket
Sign inDemoInstall

@datadog/browser-rum-core

Package Overview
Dependencies
Maintainers
1
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-rum-core - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

2

cjs/domain/assembly.js

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

},
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "5.0.0" : undefined,
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "5.1.0" : undefined,
},

@@ -60,0 +60,0 @@ application: {

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

}), scheduleViewUpdate = _a.throttled, cancelScheduleViewUpdate = _a.cancel;
var _b = (0, trackCommonViewMetrics_1.trackCommonViewMetrics)(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, startClocks), setLoadEvent = _b.setLoadEvent, stopCommonViewMetricsTracking = _b.stop, getCommonViewMetrics = _b.getCommonViewMetrics;
var _b = (0, trackCommonViewMetrics_1.trackCommonViewMetrics)(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, startClocks), setLoadEvent = _b.setLoadEvent, setViewEnd = _b.setViewEnd, stopCommonViewMetricsTracking = _b.stop, stopINPTracking = _b.stopINPTracking, getCommonViewMetrics = _b.getCommonViewMetrics;
var _c = loadingType === "initial_load" /* ViewLoadingType.INITIAL_LOAD */

@@ -156,2 +156,3 @@ ? (0, trackInitialViewMetrics_1.trackInitialViewMetrics)(lifeCycle, configuration, setLoadEvent, scheduleViewUpdate)

(0, browser_core_1.clearInterval)(keepAliveIntervalId);
setViewEnd(endClocks.relative);
stopCommonViewMetricsTracking();

@@ -166,2 +167,3 @@ triggerViewUpdate();

stopEventCountsTracking();
stopINPTracking();
stopObservable.notify();

@@ -195,4 +197,5 @@ },

function isHashAnAnchor(hash) {
var correspondingId = hash.substr(1);
return !!document.getElementById(correspondingId);
var correspondingId = hash.substring(1);
// check if the correspondingId is empty because on Firefox an empty string passed to getElementById() prints a consol warning
return correspondingId !== '' && !!document.getElementById(correspondingId);
}

@@ -199,0 +202,0 @@ function getPathFromHash(hash) {

@@ -16,4 +16,6 @@ import type { ClocksState, Duration, Observable } from '@datadog/browser-core';

stop: () => void;
stopINPTracking: () => void;
setLoadEvent: (loadEvent: Duration) => void;
setViewEnd: (viewEndTime: import("@datadog/browser-core").RelativeTime) => void;
getCommonViewMetrics: () => CommonViewMetrics;
};

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

}).stop;
var _b = (0, trackInteractionToNextPaint_1.trackInteractionToNextPaint)(configuration, viewStart, loadingType, lifeCycle), stopINPTracking = _b.stop, getInteractionToNextPaint = _b.getInteractionToNextPaint;
var _b = (0, trackInteractionToNextPaint_1.trackInteractionToNextPaint)(configuration, viewStart.relative, loadingType, lifeCycle), stopINPTracking = _b.stop, getInteractionToNextPaint = _b.getInteractionToNextPaint, setViewEnd = _b.setViewEnd;
return {

@@ -28,5 +28,6 @@ stop: function () {

stopScrollMetricsTracking();
stopINPTracking();
},
stopINPTracking: stopINPTracking,
setLoadEvent: setLoadEvent,
setViewEnd: setViewEnd,
getCommonViewMetrics: function () {

@@ -33,0 +34,0 @@ commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint();

@@ -1,5 +0,6 @@

import type { ClocksState, Duration } from '@datadog/browser-core';
import type { Duration, RelativeTime } from '@datadog/browser-core';
import type { LifeCycle } from '../../lifeCycle';
import { ViewLoadingType } from '../../../rawRumEvent.types';
import type { RumConfiguration } from '../../configuration';
export declare const MAX_INP_VALUE: Duration;
export interface InteractionToNextPaint {

@@ -15,4 +16,5 @@ value: Duration;

*/
export declare function trackInteractionToNextPaint(configuration: RumConfiguration, viewStart: ClocksState, viewLoadingType: ViewLoadingType, lifeCycle: LifeCycle): {
export declare function trackInteractionToNextPaint(configuration: RumConfiguration, viewStart: RelativeTime, viewLoadingType: ViewLoadingType, lifeCycle: LifeCycle): {
getInteractionToNextPaint: () => InteractionToNextPaint | undefined;
setViewEnd: (viewEndTime: RelativeTime) => void;
stop: () => void;

@@ -22,3 +24,4 @@ };

getViewInteractionCount: () => number;
stopViewInteractionCount: () => void;
};
export declare function isInteractionToNextPaintSupported(): boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isInteractionToNextPaintSupported = exports.trackViewInteractionCount = exports.trackInteractionToNextPaint = void 0;
exports.isInteractionToNextPaintSupported = exports.trackViewInteractionCount = exports.trackInteractionToNextPaint = exports.MAX_INP_VALUE = void 0;
var browser_core_1 = require("@datadog/browser-core");

@@ -11,2 +11,4 @@ var performanceCollection_1 = require("../../../browser/performanceCollection");

var MAX_INTERACTION_ENTRIES = 10;
// Arbitrary value to cap INP outliers
exports.MAX_INP_VALUE = (1 * browser_core_1.ONE_MINUTE);
/**

@@ -19,16 +21,15 @@ * Track the interaction to next paint (INP).

function trackInteractionToNextPaint(configuration, viewStart, viewLoadingType, lifeCycle) {
if (!isInteractionToNextPaintSupported() ||
!(0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.INTERACTION_TO_NEXT_PAINT)) {
if (!isInteractionToNextPaintSupported()) {
return {
getInteractionToNextPaint: function () { return undefined; },
setViewEnd: browser_core_1.noop,
stop: browser_core_1.noop,
};
}
var getViewInteractionCount = trackViewInteractionCount(viewLoadingType).getViewInteractionCount;
var _a = trackViewInteractionCount(viewLoadingType), getViewInteractionCount = _a.getViewInteractionCount, stopViewInteractionCount = _a.stopViewInteractionCount;
var viewEnd = Infinity;
var longestInteractions = trackLongestInteractions(getViewInteractionCount);
var interactionToNextPaint = -1;
var interactionToNextPaintTargetSelector;
var telemetryCollected = false;
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var _a;
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {

@@ -38,3 +39,6 @@ var entry = entries_1[_i];

entry.entryType === performanceCollection_1.RumPerformanceEntryType.FIRST_INPUT) &&
entry.interactionId) {
entry.interactionId &&
// Check the entry start time is inside the view bounds because some view interactions can be reported after the view end (if long duration).
entry.startTime >= viewStart &&
entry.startTime <= viewEnd) {
longestInteractions.process(entry);

@@ -46,18 +50,2 @@ }

interactionToNextPaint = newInteraction.duration;
if (interactionToNextPaint > 10 * browser_core_1.ONE_MINUTE && !telemetryCollected) {
telemetryCollected = true;
(0, browser_core_1.addTelemetryDebug)('INP outlier', {
inp: interactionToNextPaint,
interaction: {
timeFromViewStart: (0, browser_core_1.elapsed)(viewStart.relative, newInteraction.startTime),
duration: newInteraction.duration,
startTime: newInteraction.startTime,
processingStart: newInteraction.processingStart,
processingEnd: newInteraction.processingEnd,
interactionId: newInteraction.interactionId,
name: newInteraction.name,
targetNodeName: (_a = newInteraction.target) === null || _a === void 0 ? void 0 : _a.nodeName,
},
});
}
if ((0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.WEB_VITALS_ATTRIBUTION) &&

@@ -79,3 +67,3 @@ newInteraction.target &&

return {
value: interactionToNextPaint,
value: Math.min(interactionToNextPaint, exports.MAX_INP_VALUE),
targetSelector: interactionToNextPaintTargetSelector,

@@ -90,2 +78,6 @@ };

},
setViewEnd: function (viewEndTime) {
viewEnd = viewEndTime;
stopViewInteractionCount();
},
stop: stop,

@@ -134,4 +126,16 @@ };

var previousInteractionCount = viewLoadingType === "initial_load" /* ViewLoadingType.INITIAL_LOAD */ ? 0 : (0, interactionCountPolyfill_1.getInteractionCount)();
var state = { stopped: false };
function computeViewInteractionCount() {
return (0, interactionCountPolyfill_1.getInteractionCount)() - previousInteractionCount;
}
return {
getViewInteractionCount: function () { return (0, interactionCountPolyfill_1.getInteractionCount)() - previousInteractionCount; },
getViewInteractionCount: function () {
if (state.stopped) {
return state.interactionCount;
}
return computeViewInteractionCount();
},
stopViewInteractionCount: function () {
state = { stopped: true, interactionCount: computeViewInteractionCount() };
},
};

@@ -138,0 +142,0 @@ }

@@ -54,3 +54,3 @@ import { combine, isEmptyObject, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, assign, round, } from '@datadog/browser-core';

},
browser_sdk_version: canUseEventBridge() ? "5.0.0" : undefined,
browser_sdk_version: canUseEventBridge() ? "5.1.0" : undefined,
},

@@ -57,0 +57,0 @@ application: {

@@ -103,3 +103,3 @@ import { noop, PageExitReason, shallowClone, elapsed, generateUUID, ONE_MINUTE, throttle, clocksNow, clocksOrigin, timeStampNow, display, looksLikeRelativeTime, setInterval, clearInterval, setTimeout, Observable, } from '@datadog/browser-core';

}), scheduleViewUpdate = _a.throttled, cancelScheduleViewUpdate = _a.cancel;
var _b = trackCommonViewMetrics(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, startClocks), setLoadEvent = _b.setLoadEvent, stopCommonViewMetricsTracking = _b.stop, getCommonViewMetrics = _b.getCommonViewMetrics;
var _b = trackCommonViewMetrics(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, startClocks), setLoadEvent = _b.setLoadEvent, setViewEnd = _b.setViewEnd, stopCommonViewMetricsTracking = _b.stop, stopINPTracking = _b.stopINPTracking, getCommonViewMetrics = _b.getCommonViewMetrics;
var _c = loadingType === "initial_load" /* ViewLoadingType.INITIAL_LOAD */

@@ -152,2 +152,3 @@ ? trackInitialViewMetrics(lifeCycle, configuration, setLoadEvent, scheduleViewUpdate)

clearInterval(keepAliveIntervalId);
setViewEnd(endClocks.relative);
stopCommonViewMetricsTracking();

@@ -162,2 +163,3 @@ triggerViewUpdate();

stopEventCountsTracking();
stopINPTracking();
stopObservable.notify();

@@ -191,4 +193,5 @@ },

function isHashAnAnchor(hash) {
var correspondingId = hash.substr(1);
return !!document.getElementById(correspondingId);
var correspondingId = hash.substring(1);
// check if the correspondingId is empty because on Firefox an empty string passed to getElementById() prints a consol warning
return correspondingId !== '' && !!document.getElementById(correspondingId);
}

@@ -195,0 +198,0 @@ function getPathFromHash(hash) {

@@ -16,4 +16,6 @@ import type { ClocksState, Duration, Observable } from '@datadog/browser-core';

stop: () => void;
stopINPTracking: () => void;
setLoadEvent: (loadEvent: Duration) => void;
setViewEnd: (viewEndTime: import("@datadog/browser-core").RelativeTime) => void;
getCommonViewMetrics: () => CommonViewMetrics;
};

@@ -18,3 +18,3 @@ import { trackCumulativeLayoutShift } from './trackCumulativeLayoutShift';

}).stop;
var _b = trackInteractionToNextPaint(configuration, viewStart, loadingType, lifeCycle), stopINPTracking = _b.stop, getInteractionToNextPaint = _b.getInteractionToNextPaint;
var _b = trackInteractionToNextPaint(configuration, viewStart.relative, loadingType, lifeCycle), stopINPTracking = _b.stop, getInteractionToNextPaint = _b.getInteractionToNextPaint, setViewEnd = _b.setViewEnd;
return {

@@ -25,5 +25,6 @@ stop: function () {

stopScrollMetricsTracking();
stopINPTracking();
},
stopINPTracking: stopINPTracking,
setLoadEvent: setLoadEvent,
setViewEnd: setViewEnd,
getCommonViewMetrics: function () {

@@ -30,0 +31,0 @@ commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint();

@@ -1,5 +0,6 @@

import type { ClocksState, Duration } from '@datadog/browser-core';
import type { Duration, RelativeTime } from '@datadog/browser-core';
import type { LifeCycle } from '../../lifeCycle';
import { ViewLoadingType } from '../../../rawRumEvent.types';
import type { RumConfiguration } from '../../configuration';
export declare const MAX_INP_VALUE: Duration;
export interface InteractionToNextPaint {

@@ -15,4 +16,5 @@ value: Duration;

*/
export declare function trackInteractionToNextPaint(configuration: RumConfiguration, viewStart: ClocksState, viewLoadingType: ViewLoadingType, lifeCycle: LifeCycle): {
export declare function trackInteractionToNextPaint(configuration: RumConfiguration, viewStart: RelativeTime, viewLoadingType: ViewLoadingType, lifeCycle: LifeCycle): {
getInteractionToNextPaint: () => InteractionToNextPaint | undefined;
setViewEnd: (viewEndTime: RelativeTime) => void;
stop: () => void;

@@ -22,3 +24,4 @@ };

getViewInteractionCount: () => number;
stopViewInteractionCount: () => void;
};
export declare function isInteractionToNextPaintSupported(): boolean;

@@ -1,2 +0,2 @@

import { noop, isExperimentalFeatureEnabled, ExperimentalFeature, ONE_MINUTE, addTelemetryDebug, elapsed, } from '@datadog/browser-core';
import { noop, isExperimentalFeatureEnabled, ExperimentalFeature, ONE_MINUTE } from '@datadog/browser-core';
import { RumPerformanceEntryType, supportPerformanceTimingEvent } from '../../../browser/performanceCollection';

@@ -8,2 +8,4 @@ import { getSelectorFromElement } from '../../getSelectorFromElement';

var MAX_INTERACTION_ENTRIES = 10;
// Arbitrary value to cap INP outliers
export var MAX_INP_VALUE = (1 * ONE_MINUTE);
/**

@@ -16,16 +18,15 @@ * Track the interaction to next paint (INP).

export function trackInteractionToNextPaint(configuration, viewStart, viewLoadingType, lifeCycle) {
if (!isInteractionToNextPaintSupported() ||
!isExperimentalFeatureEnabled(ExperimentalFeature.INTERACTION_TO_NEXT_PAINT)) {
if (!isInteractionToNextPaintSupported()) {
return {
getInteractionToNextPaint: function () { return undefined; },
setViewEnd: noop,
stop: noop,
};
}
var getViewInteractionCount = trackViewInteractionCount(viewLoadingType).getViewInteractionCount;
var _a = trackViewInteractionCount(viewLoadingType), getViewInteractionCount = _a.getViewInteractionCount, stopViewInteractionCount = _a.stopViewInteractionCount;
var viewEnd = Infinity;
var longestInteractions = trackLongestInteractions(getViewInteractionCount);
var interactionToNextPaint = -1;
var interactionToNextPaintTargetSelector;
var telemetryCollected = false;
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var _a;
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {

@@ -35,3 +36,6 @@ var entry = entries_1[_i];

entry.entryType === RumPerformanceEntryType.FIRST_INPUT) &&
entry.interactionId) {
entry.interactionId &&
// Check the entry start time is inside the view bounds because some view interactions can be reported after the view end (if long duration).
entry.startTime >= viewStart &&
entry.startTime <= viewEnd) {
longestInteractions.process(entry);

@@ -43,18 +47,2 @@ }

interactionToNextPaint = newInteraction.duration;
if (interactionToNextPaint > 10 * ONE_MINUTE && !telemetryCollected) {
telemetryCollected = true;
addTelemetryDebug('INP outlier', {
inp: interactionToNextPaint,
interaction: {
timeFromViewStart: elapsed(viewStart.relative, newInteraction.startTime),
duration: newInteraction.duration,
startTime: newInteraction.startTime,
processingStart: newInteraction.processingStart,
processingEnd: newInteraction.processingEnd,
interactionId: newInteraction.interactionId,
name: newInteraction.name,
targetNodeName: (_a = newInteraction.target) === null || _a === void 0 ? void 0 : _a.nodeName,
},
});
}
if (isExperimentalFeatureEnabled(ExperimentalFeature.WEB_VITALS_ATTRIBUTION) &&

@@ -76,3 +64,3 @@ newInteraction.target &&

return {
value: interactionToNextPaint,
value: Math.min(interactionToNextPaint, MAX_INP_VALUE),
targetSelector: interactionToNextPaintTargetSelector,

@@ -87,2 +75,6 @@ };

},
setViewEnd: function (viewEndTime) {
viewEnd = viewEndTime;
stopViewInteractionCount();
},
stop: stop,

@@ -130,4 +122,16 @@ };

var previousInteractionCount = viewLoadingType === "initial_load" /* ViewLoadingType.INITIAL_LOAD */ ? 0 : getInteractionCount();
var state = { stopped: false };
function computeViewInteractionCount() {
return getInteractionCount() - previousInteractionCount;
}
return {
getViewInteractionCount: function () { return getInteractionCount() - previousInteractionCount; },
getViewInteractionCount: function () {
if (state.stopped) {
return state.interactionCount;
}
return computeViewInteractionCount();
},
stopViewInteractionCount: function () {
state = { stopped: true, interactionCount: computeViewInteractionCount() };
},
};

@@ -134,0 +138,0 @@ }

{
"name": "@datadog/browser-rum-core",
"version": "5.0.0",
"version": "5.1.0",
"license": "Apache-2.0",

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

"dependencies": {
"@datadog/browser-core": "5.0.0"
"@datadog/browser-core": "5.1.0"
},

@@ -32,3 +32,3 @@ "devDependencies": {

},
"gitHead": "31b6e0946955b78ce0f8f090efb3d7dd11ff8f3f"
"gitHead": "3a31ebae7c56ed6d68cabf3cd96391ad57be0ab3"
}

@@ -211,3 +211,5 @@ import type { Duration, ClocksState, TimeStamp, Subscription, RelativeTime } from '@datadog/browser-core'

setLoadEvent,
setViewEnd,
stop: stopCommonViewMetricsTracking,
stopINPTracking,
getCommonViewMetrics,

@@ -275,2 +277,3 @@ } = trackCommonViewMetrics(

clearInterval(keepAliveIntervalId)
setViewEnd(endClocks.relative)
stopCommonViewMetricsTracking()

@@ -285,2 +288,3 @@ triggerViewUpdate()

stopEventCountsTracking()
stopINPTracking()
stopObservable.notify()

@@ -319,4 +323,5 @@ },

function isHashAnAnchor(hash: string) {
const correspondingId = hash.substr(1)
return !!document.getElementById(correspondingId)
const correspondingId = hash.substring(1)
// check if the correspondingId is empty because on Firefox an empty string passed to getElementById() prints a consol warning
return correspondingId !== '' && !!document.getElementById(correspondingId)
}

@@ -323,0 +328,0 @@

@@ -51,8 +51,7 @@ import type { ClocksState, Duration, Observable } from '@datadog/browser-core'

const { stop: stopINPTracking, getInteractionToNextPaint } = trackInteractionToNextPaint(
configuration,
viewStart,
loadingType,
lifeCycle
)
const {
stop: stopINPTracking,
getInteractionToNextPaint,
setViewEnd,
} = trackInteractionToNextPaint(configuration, viewStart.relative, loadingType, lifeCycle)

@@ -64,5 +63,6 @@ return {

stopScrollMetricsTracking()
stopINPTracking()
},
stopINPTracking,
setLoadEvent,
setViewEnd,
getCommonViewMetrics: () => {

@@ -69,0 +69,0 @@ commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint()

@@ -1,10 +0,3 @@

import {
noop,
isExperimentalFeatureEnabled,
ExperimentalFeature,
ONE_MINUTE,
addTelemetryDebug,
elapsed,
} from '@datadog/browser-core'
import type { ClocksState, Duration } from '@datadog/browser-core'
import { noop, isExperimentalFeatureEnabled, ExperimentalFeature, ONE_MINUTE } from '@datadog/browser-core'
import type { Duration, RelativeTime } from '@datadog/browser-core'
import { RumPerformanceEntryType, supportPerformanceTimingEvent } from '../../../browser/performanceCollection'

@@ -22,2 +15,4 @@ import type { RumFirstInputTiming, RumPerformanceEventTiming } from '../../../browser/performanceCollection'

const MAX_INTERACTION_ENTRIES = 10
// Arbitrary value to cap INP outliers
export const MAX_INP_VALUE = (1 * ONE_MINUTE) as Duration

@@ -36,12 +31,10 @@ export interface InteractionToNextPaint {

configuration: RumConfiguration,
viewStart: ClocksState,
viewStart: RelativeTime,
viewLoadingType: ViewLoadingType,
lifeCycle: LifeCycle
) {
if (
!isInteractionToNextPaintSupported() ||
!isExperimentalFeatureEnabled(ExperimentalFeature.INTERACTION_TO_NEXT_PAINT)
) {
if (!isInteractionToNextPaintSupported()) {
return {
getInteractionToNextPaint: () => undefined,
setViewEnd: noop,
stop: noop,

@@ -51,7 +44,9 @@ }

const { getViewInteractionCount } = trackViewInteractionCount(viewLoadingType)
const { getViewInteractionCount, stopViewInteractionCount } = trackViewInteractionCount(viewLoadingType)
let viewEnd = Infinity as RelativeTime
const longestInteractions = trackLongestInteractions(getViewInteractionCount)
let interactionToNextPaint = -1 as Duration
let interactionToNextPaintTargetSelector: string | undefined
let telemetryCollected = false

@@ -63,3 +58,6 @@ const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, (entries) => {

entry.entryType === RumPerformanceEntryType.FIRST_INPUT) &&
entry.interactionId
entry.interactionId &&
// Check the entry start time is inside the view bounds because some view interactions can be reported after the view end (if long duration).
entry.startTime >= viewStart &&
entry.startTime <= viewEnd
) {

@@ -73,18 +71,2 @@ longestInteractions.process(entry)

interactionToNextPaint = newInteraction.duration
if (interactionToNextPaint > 10 * ONE_MINUTE && !telemetryCollected) {
telemetryCollected = true
addTelemetryDebug('INP outlier', {
inp: interactionToNextPaint,
interaction: {
timeFromViewStart: elapsed(viewStart.relative, newInteraction.startTime),
duration: newInteraction.duration,
startTime: newInteraction.startTime,
processingStart: newInteraction.processingStart,
processingEnd: newInteraction.processingEnd,
interactionId: newInteraction.interactionId,
name: newInteraction.name,
targetNodeName: newInteraction.target?.nodeName,
},
})
}

@@ -112,3 +94,3 @@ if (

return {
value: interactionToNextPaint,
value: Math.min(interactionToNextPaint, MAX_INP_VALUE) as Duration,
targetSelector: interactionToNextPaintTargetSelector,

@@ -122,2 +104,6 @@ }

},
setViewEnd: (viewEndTime: RelativeTime) => {
viewEnd = viewEndTime
stopViewInteractionCount()
},
stop,

@@ -174,4 +160,19 @@ }

const previousInteractionCount = viewLoadingType === ViewLoadingType.INITIAL_LOAD ? 0 : getInteractionCount()
let state: { stopped: false } | { stopped: true; interactionCount: number } = { stopped: false }
function computeViewInteractionCount() {
return getInteractionCount()! - previousInteractionCount
}
return {
getViewInteractionCount: () => getInteractionCount()! - previousInteractionCount,
getViewInteractionCount: () => {
if (state.stopped) {
return state.interactionCount
}
return computeViewInteractionCount()
},
stopViewInteractionCount: () => {
state = { stopped: true, interactionCount: computeViewInteractionCount() }
},
}

@@ -178,0 +179,0 @@ }

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