Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browser-interaction-time

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-interaction-time - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

22

dist/browser-interaction-time.es5.js

@@ -10,3 +10,2 @@ var BrowserInteractionTime = /** @class */ (function () {

}
console.log('current time inactive is', _this.getTimeInMilliseconds());
_this.browserTabInactiveCallbacks.forEach(function (fn) { return fn(); });

@@ -19,3 +18,2 @@ };

}
console.log('current time active is', _this.getTimeInMilliseconds());
_this.browserTabActiveCallbacks.forEach(function (fn) { return fn(); });

@@ -27,3 +25,3 @@ };

var callback = _a.callback, pending = _a.pending, timeInMilliseconds = _a.timeInMilliseconds;
if (pending && timeInMilliseconds <= _this.getTimeInMilliseconds()) {
if (!pending && timeInMilliseconds <= _this.getTimeInMilliseconds()) {
callback();

@@ -74,2 +72,3 @@ _this.absoluteTimeEllapsedCallbacks[index].pending = true;

_this.onTimePassed();
_this.timeInMs += _this.checkCallbacksIntervalMs;
}, _this.checkCallbacksIntervalMs);

@@ -83,3 +82,3 @@ };

_this.times.push({
start: new Date(),
start: _this.timeInMs,
stop: null

@@ -93,3 +92,3 @@ });

}
_this.times[_this.times.length - 1].stop = new Date();
_this.times[_this.times.length - 1].stop = _this.timeInMs;
_this.running = false;

@@ -111,12 +110,10 @@ };

return _this.times.reduce(function (acc, current) {
if (current.stop && current.start) {
return acc + (current.stop.getTime() - current.start.getTime());
if (current.stop) {
acc = acc + (current.stop - current.start);
}
if (!current.stop && current.start) {
var now = new Date();
return acc + (now.getTime() - current.start.getTime());
else {
acc = acc + (_this.timeInMs - current.start);
}
return acc;
}, 0);
return 0;
};

@@ -138,5 +135,6 @@ this.isRunning = function () {

this.times = [];
this.timeInMs = 0;
this.idle = false;
this.currentIdleTimeMs = 0;
this.checkCallbacksIntervalMs = checkCallbacksIntervalMs || 250;
this.checkCallbacksIntervalMs = checkCallbacksIntervalMs || 100;
this.idleTimeoutMs = idleTimeoutMs || 30000; // 30s

@@ -143,0 +141,0 @@ this.running = false;

@@ -16,3 +16,2 @@ (function (global, factory) {

}
console.log('current time inactive is', _this.getTimeInMilliseconds());
_this.browserTabInactiveCallbacks.forEach(function (fn) { return fn(); });

@@ -25,3 +24,2 @@ };

}
console.log('current time active is', _this.getTimeInMilliseconds());
_this.browserTabActiveCallbacks.forEach(function (fn) { return fn(); });

@@ -33,3 +31,3 @@ };

var callback = _a.callback, pending = _a.pending, timeInMilliseconds = _a.timeInMilliseconds;
if (pending && timeInMilliseconds <= _this.getTimeInMilliseconds()) {
if (!pending && timeInMilliseconds <= _this.getTimeInMilliseconds()) {
callback();

@@ -80,2 +78,3 @@ _this.absoluteTimeEllapsedCallbacks[index].pending = true;

_this.onTimePassed();
_this.timeInMs += _this.checkCallbacksIntervalMs;
}, _this.checkCallbacksIntervalMs);

@@ -89,3 +88,3 @@ };

_this.times.push({
start: new Date(),
start: _this.timeInMs,
stop: null

@@ -99,3 +98,3 @@ });

}
_this.times[_this.times.length - 1].stop = new Date();
_this.times[_this.times.length - 1].stop = _this.timeInMs;
_this.running = false;

@@ -117,12 +116,10 @@ };

return _this.times.reduce(function (acc, current) {
if (current.stop && current.start) {
return acc + (current.stop.getTime() - current.start.getTime());
if (current.stop) {
acc = acc + (current.stop - current.start);
}
if (!current.stop && current.start) {
var now = new Date();
return acc + (now.getTime() - current.start.getTime());
else {
acc = acc + (_this.timeInMs - current.start);
}
return acc;
}, 0);
return 0;
};

@@ -144,5 +141,6 @@ this.isRunning = function () {

this.times = [];
this.timeInMs = 0;
this.idle = false;
this.currentIdleTimeMs = 0;
this.checkCallbacksIntervalMs = checkCallbacksIntervalMs || 250;
this.checkCallbacksIntervalMs = checkCallbacksIntervalMs || 100;
this.idleTimeoutMs = idleTimeoutMs || 30000; // 30s

@@ -149,0 +147,0 @@ this.running = false;

@@ -12,3 +12,2 @@ "use strict";

}
console.log('current time inactive is', _this.getTimeInMilliseconds());
_this.browserTabInactiveCallbacks.forEach(function (fn) { return fn(); });

@@ -21,3 +20,2 @@ };

}
console.log('current time active is', _this.getTimeInMilliseconds());
_this.browserTabActiveCallbacks.forEach(function (fn) { return fn(); });

@@ -29,3 +27,3 @@ };

var callback = _a.callback, pending = _a.pending, timeInMilliseconds = _a.timeInMilliseconds;
if (pending && timeInMilliseconds <= _this.getTimeInMilliseconds()) {
if (!pending && timeInMilliseconds <= _this.getTimeInMilliseconds()) {
callback();

@@ -76,2 +74,3 @@ _this.absoluteTimeEllapsedCallbacks[index].pending = true;

_this.onTimePassed();
_this.timeInMs += _this.checkCallbacksIntervalMs;
}, _this.checkCallbacksIntervalMs);

@@ -85,3 +84,3 @@ };

_this.times.push({
start: new Date(),
start: _this.timeInMs,
stop: null

@@ -95,3 +94,3 @@ });

}
_this.times[_this.times.length - 1].stop = new Date();
_this.times[_this.times.length - 1].stop = _this.timeInMs;
_this.running = false;

@@ -113,12 +112,10 @@ };

return _this.times.reduce(function (acc, current) {
if (current.stop && current.start) {
return acc + (current.stop.getTime() - current.start.getTime());
if (current.stop) {
acc = acc + (current.stop - current.start);
}
if (!current.stop && current.start) {
var now = new Date();
return acc + (now.getTime() - current.start.getTime());
else {
acc = acc + (_this.timeInMs - current.start);
}
return acc;
}, 0);
return 0;
};

@@ -140,5 +137,6 @@ this.isRunning = function () {

this.times = [];
this.timeInMs = 0;
this.idle = false;
this.currentIdleTimeMs = 0;
this.checkCallbacksIntervalMs = checkCallbacksIntervalMs || 250;
this.checkCallbacksIntervalMs = checkCallbacksIntervalMs || 100;
this.idleTimeoutMs = idleTimeoutMs || 30000; // 30s

@@ -145,0 +143,0 @@ this.running = false;

@@ -19,3 +19,3 @@ interface BaseTimeEllapsedCallbackData {

idleTimeoutMs: number;
checkCallbacksIntervalMs: number;
checkCallbacksIntervalMs?: number;
}

@@ -28,2 +28,3 @@ export default class BrowserInteractionTime {

private currentIdleTimeMs;
private timeInMs;
private checkCallbacksIntervalMs;

@@ -30,0 +31,0 @@ private idle;

{
"name": "browser-interaction-time",
"version": "1.1.2",
"version": "1.1.3",
"description": "",

@@ -48,2 +48,3 @@ "keywords": [],

"jest": {
"setupTestFrameworkScriptFile": "jest-extended",
"transform": {

@@ -126,3 +127,6 @@ ".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"

}
},
"dependencies": {
"jest-extended": "^0.11.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

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