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

mouselog

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mouselog - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4-beta1

49

index.js

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

// const axios = require('axios').default;
const qs = require('qs');
const uuidv1 = require('uuid/v1');

@@ -9,3 +7,3 @@

url: "/data",
frequency: 2,
frequency: 50,
}

@@ -55,19 +53,21 @@ };

function uploadTrace(evts) {
const width = window.document.body.scrollWidth;
const height = window.document.body.scrollHeight;
const trace = {
idx: uploadIdx,
id: window.location.pathname, // path
uid: uuid,
width: width,
height: height,
function newTrace() {
return {
id: uuid,
url: window.location.pathname,
width: document.body.scrollWidth,
height: document.body.scrollHeight,
pageLoadTime: pageLoadTime,
label: -1,
guess: -1,
events: evts
};
events: []
}
}
function uploadTrace(evts) {
let trace = newTrace();
let start = uploadIdx * config.upload.frequency;
let end = (uploadIdx + 1) * config.upload.frequency;
trace.events = eventsList.slice(start, end)
let traceStr = JSON.stringify(trace);

@@ -78,9 +78,7 @@

credentials: 'include',
body: JSON.stringify({key: "value"}),
body: traceStr,
}).then(res => res.json());
}
function mouseHandler(evt) {
// PC's Chrome on Mobile mode can still receive "contextmenu" event with zero X, Y, so we ignore these events.

@@ -96,3 +94,4 @@ if (evt.type === 'contextmenu' && evt.pageX === 0 && evt.pageY === 0) {

}
let t = {
let tmpEvt = {
id: eventsList.length,
timestamp: getRelativeTimestampInSeconds(),

@@ -106,9 +105,9 @@ type: evt.type,

if (evt.type == "wheel") {
t.deltaX = evt.deltaX;
t.deltaY = evt.deltaY;
tmpEvt.deltaX = evt.deltaX;
tmpEvt.deltaY = evt.deltaY;
}
eventsList.push(t);
eventsList.push(tmpEvt);
if ( eventsList.length % config.upload.frequency == 0 ) {
uploadTrace(eventsList.slice( uploadIdx*config.upload.frequency, (uploadIdx+1)*config.upload.frequency));
uploadTrace();
uploadIdx += 1;

@@ -115,0 +114,0 @@ }

{
"name": "mouselog",
"version": "0.0.3",
"description": "",
"version": "0.0.4-beta1",
"description": "The mouse tracking agent for Mouselog.",
"main": "index.js",
"homepage": "https://github.com/microsoft/mouselog.js",
"scripts": {

@@ -10,8 +11,12 @@ "test": "echo \"Error: no test specified\" && exit 1"

"keywords": [],
"author": "",
"license": "ISC",
"author": "Microsoft",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/microsoft/mouselog.js/blob/master/LICENSE"
}
],
"dependencies": {
"qs": "^6.9.1",
"uuid": "^3.3.3"
}
}
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