@openreplay/tracker
Advanced tools
Comparing version 12.0.9-beta.1 to 12.0.9-beta.2
@@ -83,3 +83,3 @@ "use strict"; | ||
this.activityState = ActivityState.NotActive; | ||
this.version = '12.0.9-beta.1'; // TODO: version compatability check inside each plugin. | ||
this.version = '12.0.9-beta.2'; // TODO: version compatability check inside each plugin. | ||
this.compressionThreshold = 24 * 1000; | ||
@@ -86,0 +86,0 @@ this.restartAttempts = 0; |
@@ -46,2 +46,3 @@ "use strict"; | ||
if (id !== undefined) { | ||
; | ||
node[this.node_id] = undefined; | ||
@@ -91,3 +92,2 @@ delete node[this.node_id]; | ||
} | ||
this.nodes[id] = undefined; | ||
this.unregisterNode(node); | ||
@@ -94,0 +94,0 @@ } |
@@ -100,3 +100,3 @@ "use strict"; | ||
req.send(JSON.stringify({ | ||
trackerVersion: '12.0.9-beta.1', | ||
trackerVersion: '12.0.9-beta.2', | ||
projectKey: this.options.projectKey, | ||
@@ -103,0 +103,0 @@ doNotTrack, |
@@ -28,9 +28,2 @@ export declare const IN_BROWSER: boolean; | ||
export declare function deleteEventListener(target: EventTarget, event: string, cb: EventListenerOrEventListenerObject, capture?: boolean): void; | ||
/** | ||
* This is a brief polyfill that suits our needs | ||
* I took inspiration from Microsoft Clarity polyfill on this one | ||
* then adapted it a little bit | ||
* | ||
* I'm very grateful for their bright idea | ||
* */ | ||
export declare function requestIdleCb(callback: () => void): number | undefined; | ||
export declare function requestIdleCb(callback: () => void): void; |
@@ -146,26 +146,59 @@ "use strict"; | ||
exports.deleteEventListener = deleteEventListener; | ||
/** | ||
* This is a brief polyfill that suits our needs | ||
* I took inspiration from Microsoft Clarity polyfill on this one | ||
* then adapted it a little bit | ||
* | ||
* I'm very grateful for their bright idea | ||
* */ | ||
function requestIdleCb(callback) { | ||
const taskTimeout = 3000; | ||
if (window.requestIdleCallback) { | ||
return window.requestIdleCallback(callback, { timeout: taskTimeout }); | ||
class FIFOTaskScheduler { | ||
constructor() { | ||
this.taskQueue = []; | ||
this.isRunning = false; | ||
} | ||
else { | ||
const channel = new MessageChannel(); | ||
const incoming = channel.port1; | ||
const outgoing = channel.port2; | ||
incoming.onmessage = () => { | ||
callback(); | ||
// Adds a task to the queue | ||
addTask(task) { | ||
this.taskQueue.push(task); | ||
this.runTasks(); | ||
} | ||
// Runs tasks from the queue | ||
runTasks() { | ||
if (this.isRunning || this.taskQueue.length === 0) { | ||
return; | ||
} | ||
this.isRunning = true; | ||
const executeNextTask = () => { | ||
if (this.taskQueue.length === 0) { | ||
this.isRunning = false; | ||
return; | ||
} | ||
// Get the next task and execute it | ||
const nextTask = this.taskQueue.shift(); | ||
Promise.resolve(nextTask()).then(() => { | ||
requestAnimationFrame(() => executeNextTask()); | ||
}); | ||
}; | ||
requestAnimationFrame(() => { | ||
outgoing.postMessage(1); | ||
}); | ||
executeNextTask(); | ||
} | ||
} | ||
const scheduler = new FIFOTaskScheduler(); | ||
function requestIdleCb(callback) { | ||
// performance improvement experiment; | ||
scheduler.addTask(callback); | ||
/** | ||
* This is a brief polyfill that suits our needs | ||
* I took inspiration from Microsoft Clarity polyfill on this one | ||
* then adapted it a little bit | ||
* | ||
* I'm very grateful for their bright idea | ||
* */ | ||
// const taskTimeout = 3000 | ||
// if (window.requestIdleCallback) { | ||
// return window.requestIdleCallback(callback, { timeout: taskTimeout }) | ||
// } else { | ||
// const channel = new MessageChannel() | ||
// const incoming = channel.port1 | ||
// const outgoing = channel.port2 | ||
// | ||
// incoming.onmessage = (): void => { | ||
// callback() | ||
// } | ||
// requestAnimationFrame((): void => { | ||
// outgoing.postMessage(1) | ||
// }) | ||
// } | ||
} | ||
exports.requestIdleCb = requestIdleCb; |
@@ -54,3 +54,3 @@ import ConditionsManager from '../modules/conditionsManager.js'; | ||
this.activityState = ActivityState.NotActive; | ||
this.version = '12.0.9-beta.1'; // TODO: version compatability check inside each plugin. | ||
this.version = '12.0.9-beta.2'; // TODO: version compatability check inside each plugin. | ||
this.compressionThreshold = 24 * 1000; | ||
@@ -57,0 +57,0 @@ this.restartAttempts = 0; |
@@ -44,2 +44,3 @@ import { createEventListener, deleteEventListener } from '../utils.js'; | ||
if (id !== undefined) { | ||
; | ||
node[this.node_id] = undefined; | ||
@@ -89,3 +90,2 @@ delete node[this.node_id]; | ||
} | ||
this.nodes[id] = undefined; | ||
this.unregisterNode(node); | ||
@@ -92,0 +92,0 @@ } |
@@ -69,3 +69,3 @@ import App, { DEFAULT_INGEST_POINT } from './app/index.js'; | ||
req.send(JSON.stringify({ | ||
trackerVersion: '12.0.9-beta.1', | ||
trackerVersion: '12.0.9-beta.2', | ||
projectKey: this.options.projectKey, | ||
@@ -72,0 +72,0 @@ doNotTrack, |
@@ -28,9 +28,2 @@ export declare const IN_BROWSER: boolean; | ||
export declare function deleteEventListener(target: EventTarget, event: string, cb: EventListenerOrEventListenerObject, capture?: boolean): void; | ||
/** | ||
* This is a brief polyfill that suits our needs | ||
* I took inspiration from Microsoft Clarity polyfill on this one | ||
* then adapted it a little bit | ||
* | ||
* I'm very grateful for their bright idea | ||
* */ | ||
export declare function requestIdleCb(callback: () => void): number | undefined; | ||
export declare function requestIdleCb(callback: () => void): void; |
@@ -129,25 +129,58 @@ const DEPRECATED_ATTRS = { htmlmasked: 'hidden', masked: 'obscured' }; | ||
} | ||
/** | ||
* This is a brief polyfill that suits our needs | ||
* I took inspiration from Microsoft Clarity polyfill on this one | ||
* then adapted it a little bit | ||
* | ||
* I'm very grateful for their bright idea | ||
* */ | ||
export function requestIdleCb(callback) { | ||
const taskTimeout = 3000; | ||
if (window.requestIdleCallback) { | ||
return window.requestIdleCallback(callback, { timeout: taskTimeout }); | ||
class FIFOTaskScheduler { | ||
constructor() { | ||
this.taskQueue = []; | ||
this.isRunning = false; | ||
} | ||
else { | ||
const channel = new MessageChannel(); | ||
const incoming = channel.port1; | ||
const outgoing = channel.port2; | ||
incoming.onmessage = () => { | ||
callback(); | ||
// Adds a task to the queue | ||
addTask(task) { | ||
this.taskQueue.push(task); | ||
this.runTasks(); | ||
} | ||
// Runs tasks from the queue | ||
runTasks() { | ||
if (this.isRunning || this.taskQueue.length === 0) { | ||
return; | ||
} | ||
this.isRunning = true; | ||
const executeNextTask = () => { | ||
if (this.taskQueue.length === 0) { | ||
this.isRunning = false; | ||
return; | ||
} | ||
// Get the next task and execute it | ||
const nextTask = this.taskQueue.shift(); | ||
Promise.resolve(nextTask()).then(() => { | ||
requestAnimationFrame(() => executeNextTask()); | ||
}); | ||
}; | ||
requestAnimationFrame(() => { | ||
outgoing.postMessage(1); | ||
}); | ||
executeNextTask(); | ||
} | ||
} | ||
const scheduler = new FIFOTaskScheduler(); | ||
export function requestIdleCb(callback) { | ||
// performance improvement experiment; | ||
scheduler.addTask(callback); | ||
/** | ||
* This is a brief polyfill that suits our needs | ||
* I took inspiration from Microsoft Clarity polyfill on this one | ||
* then adapted it a little bit | ||
* | ||
* I'm very grateful for their bright idea | ||
* */ | ||
// const taskTimeout = 3000 | ||
// if (window.requestIdleCallback) { | ||
// return window.requestIdleCallback(callback, { timeout: taskTimeout }) | ||
// } else { | ||
// const channel = new MessageChannel() | ||
// const incoming = channel.port1 | ||
// const outgoing = channel.port2 | ||
// | ||
// incoming.onmessage = (): void => { | ||
// callback() | ||
// } | ||
// requestAnimationFrame((): void => { | ||
// outgoing.postMessage(1) | ||
// }) | ||
// } | ||
} |
{ | ||
"name": "@openreplay/tracker", | ||
"description": "The OpenReplay tracker main package", | ||
"version": "12.0.9-beta.1", | ||
"version": "12.0.9-beta.2", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "logging", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3922489
23353