@openreplay/tracker 18.0.10 → 18.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/entry.js +53 -14
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +53 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/lib/entry.js +53 -14
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +53 -14
- package/dist/lib/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/entry.js
CHANGED
|
@@ -1473,6 +1473,7 @@ const perf = IN_BROWSER && 'performance' in window && 'memory' in performance //
|
|
|
1473
1473
|
: { memory: {} };
|
|
1474
1474
|
const deviceMemory = IN_BROWSER ? (navigator.deviceMemory || 0) * 1024 : 0;
|
|
1475
1475
|
const jsHeapSizeLimit = perf.memory.jsHeapSizeLimit || 0;
|
|
1476
|
+
const PAUSED = -1;
|
|
1476
1477
|
function Performance (app, opts) {
|
|
1477
1478
|
const options = Object.assign({
|
|
1478
1479
|
capturePerformance: true,
|
|
@@ -1480,35 +1481,73 @@ function Performance (app, opts) {
|
|
|
1480
1481
|
if (!options.capturePerformance) {
|
|
1481
1482
|
return;
|
|
1482
1483
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1484
|
+
// Capture references up front so a third party that later replaces the global
|
|
1485
|
+
// (Sentry's browserApiErrors, polyfills, zones, ...) can't change which
|
|
1486
|
+
// implementation we drive the loop with mid-session.
|
|
1487
|
+
const raf = IN_BROWSER && typeof window.requestAnimationFrame === 'function'
|
|
1488
|
+
? window.requestAnimationFrame.bind(window)
|
|
1489
|
+
: null;
|
|
1490
|
+
const caf = IN_BROWSER && typeof window.cancelAnimationFrame === 'function'
|
|
1491
|
+
? window.cancelAnimationFrame.bind(window)
|
|
1492
|
+
: null;
|
|
1493
|
+
let running = false;
|
|
1494
|
+
let frames = 0;
|
|
1495
|
+
let ticks = 0;
|
|
1496
|
+
let rafHandle = null;
|
|
1497
|
+
let inFrame = false;
|
|
1498
|
+
const onFrame = () => {
|
|
1499
|
+
rafHandle = null;
|
|
1500
|
+
if (!running || frames === PAUSED) {
|
|
1487
1501
|
return;
|
|
1488
1502
|
}
|
|
1489
1503
|
frames++;
|
|
1490
|
-
|
|
1504
|
+
if (inFrame) {
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1507
|
+
scheduleFrame();
|
|
1508
|
+
};
|
|
1509
|
+
const scheduleFrame = () => {
|
|
1510
|
+
if (!raf || rafHandle !== null) {
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
inFrame = true;
|
|
1514
|
+
rafHandle = raf(onFrame);
|
|
1515
|
+
inFrame = false;
|
|
1516
|
+
};
|
|
1517
|
+
const stopLoop = () => {
|
|
1518
|
+
if (rafHandle !== null && caf) {
|
|
1519
|
+
caf(rafHandle);
|
|
1520
|
+
}
|
|
1521
|
+
rafHandle = null;
|
|
1491
1522
|
};
|
|
1492
1523
|
app.ticker.attach(() => {
|
|
1493
|
-
if (
|
|
1524
|
+
if (!running || ticks === PAUSED) {
|
|
1494
1525
|
return;
|
|
1495
1526
|
}
|
|
1496
1527
|
ticks++;
|
|
1497
1528
|
}, 0, false);
|
|
1498
1529
|
const sendPerformanceTrack = () => {
|
|
1499
|
-
if (
|
|
1530
|
+
if (!running) {
|
|
1500
1531
|
return;
|
|
1501
1532
|
}
|
|
1502
1533
|
app.send(PerformanceTrack(frames, ticks, perf.memory.totalJSHeapSize || 0, perf.memory.usedJSHeapSize || 0));
|
|
1503
|
-
|
|
1534
|
+
if (document.hidden) {
|
|
1535
|
+
frames = ticks = PAUSED;
|
|
1536
|
+
}
|
|
1537
|
+
else {
|
|
1538
|
+
frames = ticks = 0;
|
|
1539
|
+
scheduleFrame();
|
|
1540
|
+
}
|
|
1504
1541
|
};
|
|
1505
1542
|
app.attachStartCallback(() => {
|
|
1506
|
-
|
|
1543
|
+
running = true;
|
|
1544
|
+
frames = ticks = PAUSED;
|
|
1507
1545
|
sendPerformanceTrack();
|
|
1508
|
-
nextFrame();
|
|
1509
1546
|
});
|
|
1510
1547
|
app.attachStopCallback(() => {
|
|
1511
|
-
|
|
1548
|
+
running = false;
|
|
1549
|
+
frames = ticks = 0;
|
|
1550
|
+
stopLoop();
|
|
1512
1551
|
});
|
|
1513
1552
|
app.ticker.attach(sendPerformanceTrack, 165, false);
|
|
1514
1553
|
if (document.hidden !== undefined) {
|
|
@@ -4013,7 +4052,7 @@ class App {
|
|
|
4013
4052
|
this.stopCallbacks = [];
|
|
4014
4053
|
this.commitCallbacks = [];
|
|
4015
4054
|
this.activityState = ActivityState.NotActive;
|
|
4016
|
-
this.version = '18.0.
|
|
4055
|
+
this.version = '18.0.11'; // TODO: version compatability check inside each plugin.
|
|
4017
4056
|
this.socketMode = false;
|
|
4018
4057
|
this.compressionThreshold = 24 * 1000;
|
|
4019
4058
|
this.bc = null;
|
|
@@ -9012,7 +9051,7 @@ class ConstantProperties {
|
|
|
9012
9051
|
user_id: this.user_id,
|
|
9013
9052
|
distinct_id: this.deviceId,
|
|
9014
9053
|
sdk_edition: 'web',
|
|
9015
|
-
sdk_version: '18.0.
|
|
9054
|
+
sdk_version: '18.0.11',
|
|
9016
9055
|
timezone: getUTCOffsetString(),
|
|
9017
9056
|
search_engine: this.searchEngine,
|
|
9018
9057
|
};
|
|
@@ -9714,7 +9753,7 @@ class API {
|
|
|
9714
9753
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9715
9754
|
const doNotTrack = this.checkDoNotTrack();
|
|
9716
9755
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9717
|
-
trackerVersion: '18.0.
|
|
9756
|
+
trackerVersion: '18.0.11',
|
|
9718
9757
|
projectKey: this.options.projectKey,
|
|
9719
9758
|
doNotTrack,
|
|
9720
9759
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|