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" | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
9042
1
0
117
1
1
- Removedqs@^6.9.1
- Removedcall-bind@1.0.7(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.1.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.1.0(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedqs@6.13.1(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedside-channel@1.0.6(transitive)