@purespectrum1/purescore-client 0.7.0
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/README.md +55 -0
- package/lib/application/auto-init.d.ts +44 -0
- package/lib/application/auto-init.js +245 -0
- package/lib/application/device-identifier.d.ts +116 -0
- package/lib/application/device-identifier.js +169 -0
- package/lib/domain/models/crosscutting/device-intelligence.d.ts +11 -0
- package/lib/domain/models/crosscutting/device-intelligence.js +18 -0
- package/lib/domain/models/crosscutting/index.d.ts +1 -0
- package/lib/domain/models/crosscutting/index.js +17 -0
- package/lib/domain/protocols/cache/get-storage.d.ts +8 -0
- package/lib/domain/protocols/cache/get-storage.js +2 -0
- package/lib/domain/protocols/cache/index.d.ts +3 -0
- package/lib/domain/protocols/cache/index.js +19 -0
- package/lib/domain/protocols/cache/remove-storage.d.ts +6 -0
- package/lib/domain/protocols/cache/remove-storage.js +2 -0
- package/lib/domain/protocols/cache/set-storage.d.ts +7 -0
- package/lib/domain/protocols/cache/set-storage.js +2 -0
- package/lib/domain/protocols/http/http-client.d.ts +23 -0
- package/lib/domain/protocols/http/http-client.js +13 -0
- package/lib/domain/protocols/services/behavioural-biometrics/cursor-behavior.d.ts +63 -0
- package/lib/domain/protocols/services/behavioural-biometrics/cursor-behavior.js +2 -0
- package/lib/domain/protocols/services/behavioural-biometrics/index.d.ts +3 -0
- package/lib/domain/protocols/services/behavioural-biometrics/index.js +19 -0
- package/lib/domain/protocols/services/behavioural-biometrics/keystorke-metrics.d.ts +35 -0
- package/lib/domain/protocols/services/behavioural-biometrics/keystorke-metrics.js +2 -0
- package/lib/domain/protocols/services/behavioural-biometrics/touch-behavior.d.ts +88 -0
- package/lib/domain/protocols/services/behavioural-biometrics/touch-behavior.js +2 -0
- package/lib/domain/protocols/services/device-fingerprint/display.d.ts +22 -0
- package/lib/domain/protocols/services/device-fingerprint/display.js +2 -0
- package/lib/domain/protocols/services/device-fingerprint/index.d.ts +3 -0
- package/lib/domain/protocols/services/device-fingerprint/index.js +19 -0
- package/lib/domain/protocols/services/device-fingerprint/navigator.d.ts +63 -0
- package/lib/domain/protocols/services/device-fingerprint/navigator.js +2 -0
- package/lib/domain/protocols/services/device-fingerprint/utils.d.ts +40 -0
- package/lib/domain/protocols/services/device-fingerprint/utils.js +2 -0
- package/lib/domain/protocols/services/device-identifier.d.ts +96 -0
- package/lib/domain/protocols/services/device-identifier.js +2 -0
- package/lib/domain/protocols/services/device-intelligence.d.ts +5 -0
- package/lib/domain/protocols/services/device-intelligence.js +2 -0
- package/lib/domain/protocols/services/listeners.d.ts +9 -0
- package/lib/domain/protocols/services/listeners.js +2 -0
- package/lib/domain/protocols/services/single-script-injection/auto-init.d.ts +120 -0
- package/lib/domain/protocols/services/single-script-injection/auto-init.js +2 -0
- package/lib/domain/protocols/services/single-script-injection/index.d.ts +1 -0
- package/lib/domain/protocols/services/single-script-injection/index.js +17 -0
- package/lib/domain/services/behavioural-biometrics/collector.d.ts +94 -0
- package/lib/domain/services/behavioural-biometrics/collector.js +229 -0
- package/lib/domain/services/behavioural-biometrics/cursor-behavior.d.ts +87 -0
- package/lib/domain/services/behavioural-biometrics/cursor-behavior.js +369 -0
- package/lib/domain/services/behavioural-biometrics/index.d.ts +4 -0
- package/lib/domain/services/behavioural-biometrics/index.js +20 -0
- package/lib/domain/services/behavioural-biometrics/keystroke-metrics.d.ts +60 -0
- package/lib/domain/services/behavioural-biometrics/keystroke-metrics.js +213 -0
- package/lib/domain/services/behavioural-biometrics/touch-behavior.d.ts +125 -0
- package/lib/domain/services/behavioural-biometrics/touch-behavior.js +413 -0
- package/lib/domain/services/device-fingerprint/audio.d.ts +14 -0
- package/lib/domain/services/device-fingerprint/audio.js +109 -0
- package/lib/domain/services/device-fingerprint/canvas.d.ts +10 -0
- package/lib/domain/services/device-fingerprint/canvas.js +33 -0
- package/lib/domain/services/device-fingerprint/display.d.ts +49 -0
- package/lib/domain/services/device-fingerprint/display.js +88 -0
- package/lib/domain/services/device-fingerprint/hash.d.ts +14 -0
- package/lib/domain/services/device-fingerprint/hash.js +60 -0
- package/lib/domain/services/device-fingerprint/index.d.ts +8 -0
- package/lib/domain/services/device-fingerprint/index.js +24 -0
- package/lib/domain/services/device-fingerprint/navigator.d.ts +110 -0
- package/lib/domain/services/device-fingerprint/navigator.js +213 -0
- package/lib/domain/services/device-fingerprint/pointer-capability.d.ts +14 -0
- package/lib/domain/services/device-fingerprint/pointer-capability.js +42 -0
- package/lib/domain/services/device-fingerprint/storage.d.ts +44 -0
- package/lib/domain/services/device-fingerprint/storage.js +64 -0
- package/lib/domain/services/device-fingerprint/utils.d.ts +42 -0
- package/lib/domain/services/device-fingerprint/utils.js +95 -0
- package/lib/domain/services/device-intelligence.d.ts +10 -0
- package/lib/domain/services/device-intelligence.js +59 -0
- package/lib/domain/services/single-script-injection/checkpoint-scheduler.d.ts +37 -0
- package/lib/domain/services/single-script-injection/checkpoint-scheduler.js +94 -0
- package/lib/domain/services/single-script-injection/index.d.ts +3 -0
- package/lib/domain/services/single-script-injection/index.js +19 -0
- package/lib/domain/services/single-script-injection/response-delivery.d.ts +47 -0
- package/lib/domain/services/single-script-injection/response-delivery.js +115 -0
- package/lib/domain/services/single-script-injection/schedule-store.d.ts +69 -0
- package/lib/domain/services/single-script-injection/schedule-store.js +146 -0
- package/lib/domain/services/snapshot-store.d.ts +19 -0
- package/lib/domain/services/snapshot-store.js +36 -0
- package/lib/domain/services/spa-navigation.d.ts +15 -0
- package/lib/domain/services/spa-navigation.js +40 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.js +27 -0
- package/lib/infra/cache/index.d.ts +3 -0
- package/lib/infra/cache/index.js +19 -0
- package/lib/infra/cache/local-storage-adapter.d.ts +8 -0
- package/lib/infra/cache/local-storage-adapter.js +14 -0
- package/lib/infra/cache/session-storage-adapter.d.ts +8 -0
- package/lib/infra/cache/session-storage-adapter.js +14 -0
- package/lib/infra/cache/web-storage-adapter.d.ts +13 -0
- package/lib/infra/cache/web-storage-adapter.js +33 -0
- package/lib/infra/http/axios-http-client.d.ts +4 -0
- package/lib/infra/http/axios-http-client.js +39 -0
- package/lib/validation/builder.d.ts +43 -0
- package/lib/validation/builder.js +85 -0
- package/lib/validation/composite.d.ts +13 -0
- package/lib/validation/composite.js +23 -0
- package/lib/validation/errors/index.d.ts +2 -0
- package/lib/validation/errors/index.js +18 -0
- package/lib/validation/errors/invalid-field-error.d.ts +7 -0
- package/lib/validation/errors/invalid-field-error.js +14 -0
- package/lib/validation/errors/required-field-error.d.ts +3 -0
- package/lib/validation/errors/required-field-error.js +10 -0
- package/lib/validation/index.d.ts +5 -0
- package/lib/validation/index.js +21 -0
- package/lib/validation/protocols/index.d.ts +1 -0
- package/lib/validation/protocols/index.js +17 -0
- package/lib/validation/protocols/validator.d.ts +11 -0
- package/lib/validation/protocols/validator.js +2 -0
- package/lib/validation/validators/behavioural-signal.d.ts +27 -0
- package/lib/validation/validators/behavioural-signal.js +56 -0
- package/lib/validation/validators/country-code.d.ts +14 -0
- package/lib/validation/validators/country-code.js +24 -0
- package/lib/validation/validators/global-function.d.ts +14 -0
- package/lib/validation/validators/global-function.js +29 -0
- package/lib/validation/validators/index.d.ts +9 -0
- package/lib/validation/validators/index.js +25 -0
- package/lib/validation/validators/interpolated-template.d.ts +14 -0
- package/lib/validation/validators/interpolated-template.js +28 -0
- package/lib/validation/validators/json-object.d.ts +14 -0
- package/lib/validation/validators/json-object.js +33 -0
- package/lib/validation/validators/language-code.d.ts +13 -0
- package/lib/validation/validators/language-code.js +23 -0
- package/lib/validation/validators/positive-number.d.ts +13 -0
- package/lib/validation/validators/positive-number.js +24 -0
- package/lib/validation/validators/required-string.d.ts +10 -0
- package/lib/validation/validators/required-string.js +19 -0
- package/lib/validation/validators/schedule-record.d.ts +26 -0
- package/lib/validation/validators/schedule-record.js +33 -0
- package/package.json +51 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generates a canvas fingerprint, which is a technique used to identify browsers based on their unique rendering of a canvas element.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Canvas = void 0;
|
|
7
|
+
class Canvas {
|
|
8
|
+
getCanvasFingerprint() {
|
|
9
|
+
const canvas = document.createElement('canvas');
|
|
10
|
+
const ctx = this._isCanvasSupported(canvas);
|
|
11
|
+
if (ctx) {
|
|
12
|
+
const txt = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()_+-={}|[]\\:"<>?/.,;';
|
|
13
|
+
ctx.textBaseline = 'top';
|
|
14
|
+
ctx.font = '14px \'Arial\'';
|
|
15
|
+
ctx.textBaseline = 'alphabetic';
|
|
16
|
+
ctx.fillStyle = '#f60';
|
|
17
|
+
ctx.fillRect(125, 1, 62, 20);
|
|
18
|
+
ctx.fillStyle = '#069';
|
|
19
|
+
ctx.fillText(txt, 2, 15);
|
|
20
|
+
ctx.fillStyle = 'rgba(102, 204, 0, 0.7)';
|
|
21
|
+
ctx.fillText(txt, 4, 17);
|
|
22
|
+
return canvas.toDataURL();
|
|
23
|
+
}
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the browser supports the canvas element and successfully returns a 2D context.
|
|
28
|
+
*/
|
|
29
|
+
_isCanvasSupported(canvas) {
|
|
30
|
+
return canvas.getContext ? canvas.getContext('2d') : null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Canvas = Canvas;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DisplayChecksInput, DisplayChecks } from "../../protocols/services/device-fingerprint/display";
|
|
2
|
+
export declare class Display {
|
|
3
|
+
/**
|
|
4
|
+
* Returns an object containing details about the display, including color depth, height, width, available height and width, inner height and width, and outer height and width.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Object} An object containing display details or an empty object if an error occurs.
|
|
7
|
+
* @example
|
|
8
|
+
* const displayDetails = getDisplayDetails();
|
|
9
|
+
* console.log(displayDetails);
|
|
10
|
+
* // Output: { colorDepth: 24, height: 1080, width: 1920, availHeight: 1040, availWidth: 1920, innerHeight: 1040, innerWidth: 1920, outerHeight: 1080, outerWidth: 1920 }
|
|
11
|
+
*/
|
|
12
|
+
getDisplayDetails(): DisplayChecksInput | {};
|
|
13
|
+
/**
|
|
14
|
+
* Returns the screen resolution as an array of two numbers, with the option to account for orientation.
|
|
15
|
+
*
|
|
16
|
+
* @param {boolean} [orientation=false] Whether to account for orientation when determining the resolution.
|
|
17
|
+
* @returns {number[]} An array containing the screen resolution.
|
|
18
|
+
* @example
|
|
19
|
+
* const resolution = getScreenResolution(true);
|
|
20
|
+
* console.log(resolution);
|
|
21
|
+
* // Output: [1080, 1920]
|
|
22
|
+
*/
|
|
23
|
+
getScreenResolution(orientation?: boolean): number[];
|
|
24
|
+
/**
|
|
25
|
+
* Returns an object containing the screen's color depth and resolution, with the option to include the resolution and account for orientation.
|
|
26
|
+
*
|
|
27
|
+
* @param {boolean} [resolution=false] Whether to include the resolution in the output.
|
|
28
|
+
* @param {boolean} [orientation=false] Whether to account for orientation when determining the resolution.
|
|
29
|
+
* @returns {Object} An object containing the screen's color depth and resolution.
|
|
30
|
+
* @example
|
|
31
|
+
* const screenProperties = getScreenProperties(true, true);
|
|
32
|
+
* console.log(screenProperties);
|
|
33
|
+
* // Output: { colorDepth: 24, resolution: [1080, 1920] }
|
|
34
|
+
*/
|
|
35
|
+
getScreenProperties(resolution?: boolean, orientation?: boolean): {
|
|
36
|
+
colorDepth: number;
|
|
37
|
+
resolution: number[] | null;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Returns an object containing various display checks, including resolution, width, height, and aspect ratio.
|
|
41
|
+
*
|
|
42
|
+
* @returns {DisplayChecks} An object containing display checks.
|
|
43
|
+
* @example
|
|
44
|
+
* const displayChecks = displayChecks();
|
|
45
|
+
* console.log(displayChecks);
|
|
46
|
+
* // Output: { resolution: [1920, 1080], width: 1920, width1: 1, width2: 1, height1: 0.9375, height2: 0.9375, isWider: false, isTaller: false, aspectRatio: 1.7777777777777777 }
|
|
47
|
+
*/
|
|
48
|
+
displayChecks(): DisplayChecks;
|
|
49
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Display = void 0;
|
|
4
|
+
class Display {
|
|
5
|
+
/**
|
|
6
|
+
* Returns an object containing details about the display, including color depth, height, width, available height and width, inner height and width, and outer height and width.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Object} An object containing display details or an empty object if an error occurs.
|
|
9
|
+
* @example
|
|
10
|
+
* const displayDetails = getDisplayDetails();
|
|
11
|
+
* console.log(displayDetails);
|
|
12
|
+
* // Output: { colorDepth: 24, height: 1080, width: 1920, availHeight: 1040, availWidth: 1920, innerHeight: 1040, innerWidth: 1920, outerHeight: 1080, outerWidth: 1920 }
|
|
13
|
+
*/
|
|
14
|
+
getDisplayDetails() {
|
|
15
|
+
try {
|
|
16
|
+
return {
|
|
17
|
+
colorDepth: screen.colorDepth,
|
|
18
|
+
height: screen.height,
|
|
19
|
+
width: screen.width,
|
|
20
|
+
availHeight: screen.availHeight,
|
|
21
|
+
availWidth: screen.availWidth,
|
|
22
|
+
innerHeight: window.innerHeight,
|
|
23
|
+
innerWidth: window.innerWidth,
|
|
24
|
+
outerHeight: window.outerHeight,
|
|
25
|
+
outerWidth: window.outerWidth
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the screen resolution as an array of two numbers, with the option to account for orientation.
|
|
34
|
+
*
|
|
35
|
+
* @param {boolean} [orientation=false] Whether to account for orientation when determining the resolution.
|
|
36
|
+
* @returns {number[]} An array containing the screen resolution.
|
|
37
|
+
* @example
|
|
38
|
+
* const resolution = getScreenResolution(true);
|
|
39
|
+
* console.log(resolution);
|
|
40
|
+
* // Output: [1080, 1920]
|
|
41
|
+
*/
|
|
42
|
+
getScreenResolution(orientation) {
|
|
43
|
+
const resolution = orientation
|
|
44
|
+
? (screen.height > screen.width ? [screen.height, screen.width] : [screen.width, screen.height])
|
|
45
|
+
: [screen.height, screen.width];
|
|
46
|
+
return resolution;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns an object containing the screen's color depth and resolution, with the option to include the resolution and account for orientation.
|
|
50
|
+
*
|
|
51
|
+
* @param {boolean} [resolution=false] Whether to include the resolution in the output.
|
|
52
|
+
* @param {boolean} [orientation=false] Whether to account for orientation when determining the resolution.
|
|
53
|
+
* @returns {Object} An object containing the screen's color depth and resolution.
|
|
54
|
+
* @example
|
|
55
|
+
* const screenProperties = getScreenProperties(true, true);
|
|
56
|
+
* console.log(screenProperties);
|
|
57
|
+
* // Output: { colorDepth: 24, resolution: [1080, 1920] }
|
|
58
|
+
*/
|
|
59
|
+
getScreenProperties(resolution, orientation) {
|
|
60
|
+
return {
|
|
61
|
+
colorDepth: screen.colorDepth,
|
|
62
|
+
resolution: resolution ? this.getScreenResolution(orientation) : null,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns an object containing various display checks, including resolution, width, height, and aspect ratio.
|
|
67
|
+
*
|
|
68
|
+
* @returns {DisplayChecks} An object containing display checks.
|
|
69
|
+
* @example
|
|
70
|
+
* const displayChecks = displayChecks();
|
|
71
|
+
* console.log(displayChecks);
|
|
72
|
+
* // Output: { resolution: [1920, 1080], width: 1920, width1: 1, width2: 1, height1: 0.9375, height2: 0.9375, isWider: false, isTaller: false, aspectRatio: 1.7777777777777777 }
|
|
73
|
+
*/
|
|
74
|
+
displayChecks() {
|
|
75
|
+
return {
|
|
76
|
+
resolution: [window.innerWidth, window.innerHeight],
|
|
77
|
+
width: window.innerWidth,
|
|
78
|
+
width1: window.innerWidth / screen.width,
|
|
79
|
+
width2: window.innerWidth / window.outerWidth,
|
|
80
|
+
height1: window.innerHeight / screen.height,
|
|
81
|
+
height2: window.innerHeight / window.outerHeight,
|
|
82
|
+
isWider: window.innerWidth > screen.width,
|
|
83
|
+
isTaller: window.innerHeight > screen.height,
|
|
84
|
+
aspectRatio: screen.width / screen.height
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.Display = Display;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes the 32-bit MurmurHash3 of a given string.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} key - The input string to hash.
|
|
5
|
+
* @param {number} seed - The seed value for the hash.
|
|
6
|
+
* @returns {number} The 32-bit hash value.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const hash = new Hash().murmurhash3_32_gc("Hello, World!", 0);
|
|
10
|
+
* console.log(hash); // Output: 592631239
|
|
11
|
+
*/
|
|
12
|
+
export declare class Hash {
|
|
13
|
+
murmurhash3_32_gc(key: string, seed: number): number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Computes the 32-bit MurmurHash3 of a given string.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} key - The input string to hash.
|
|
6
|
+
* @param {number} seed - The seed value for the hash.
|
|
7
|
+
* @returns {number} The 32-bit hash value.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const hash = new Hash().murmurhash3_32_gc("Hello, World!", 0);
|
|
11
|
+
* console.log(hash); // Output: 592631239
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Hash = void 0;
|
|
15
|
+
class Hash {
|
|
16
|
+
murmurhash3_32_gc(key, seed) {
|
|
17
|
+
const len = key.length;
|
|
18
|
+
const bytes = len - (len & 3); // largest multiple of 4 <= len
|
|
19
|
+
let h1 = seed | 0;
|
|
20
|
+
const c1 = 0xcc9e2d51;
|
|
21
|
+
const c2 = 0x1b873593;
|
|
22
|
+
let i = 0;
|
|
23
|
+
let k1;
|
|
24
|
+
for (; i < bytes; i += 4) {
|
|
25
|
+
k1 = (key.charCodeAt(i) & 0xff) |
|
|
26
|
+
((key.charCodeAt(i + 1) & 0xff) << 8) |
|
|
27
|
+
((key.charCodeAt(i + 2) & 0xff) << 16) |
|
|
28
|
+
((key.charCodeAt(i + 3) & 0xff) << 24);
|
|
29
|
+
k1 = Math.imul(k1, c1);
|
|
30
|
+
k1 = (k1 << 15) | (k1 >>> 17);
|
|
31
|
+
k1 = Math.imul(k1, c2);
|
|
32
|
+
h1 ^= k1;
|
|
33
|
+
h1 = (h1 << 13) | (h1 >>> 19);
|
|
34
|
+
h1 = (Math.imul(h1, 5) + 0xe6546b64) | 0;
|
|
35
|
+
}
|
|
36
|
+
k1 = 0;
|
|
37
|
+
switch (len & 3) {
|
|
38
|
+
case 3:
|
|
39
|
+
k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
|
|
40
|
+
// eslint-disable-next-line no-fallthrough
|
|
41
|
+
case 2:
|
|
42
|
+
k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
|
|
43
|
+
// eslint-disable-next-line no-fallthrough
|
|
44
|
+
case 1:
|
|
45
|
+
k1 ^= (key.charCodeAt(i) & 0xff);
|
|
46
|
+
k1 = Math.imul(k1, c1);
|
|
47
|
+
k1 = (k1 << 15) | (k1 >>> 17);
|
|
48
|
+
k1 = Math.imul(k1, c2);
|
|
49
|
+
h1 ^= k1;
|
|
50
|
+
}
|
|
51
|
+
h1 ^= len;
|
|
52
|
+
h1 ^= h1 >>> 16;
|
|
53
|
+
h1 = Math.imul(h1, 0x85ebca6b);
|
|
54
|
+
h1 ^= h1 >>> 13;
|
|
55
|
+
h1 = Math.imul(h1, 0xc2b2ae35);
|
|
56
|
+
h1 ^= h1 >>> 16;
|
|
57
|
+
return h1 >>> 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.Hash = Hash;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./audio"), exports);
|
|
18
|
+
__exportStar(require("./canvas"), exports);
|
|
19
|
+
__exportStar(require("./display"), exports);
|
|
20
|
+
__exportStar(require("./hash"), exports);
|
|
21
|
+
__exportStar(require("./navigator"), exports);
|
|
22
|
+
__exportStar(require("./pointer-capability"), exports);
|
|
23
|
+
__exportStar(require("./storage"), exports);
|
|
24
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Language, UADataValues, UAParserDeviceType } from "../../protocols/services/device-fingerprint/navigator";
|
|
2
|
+
export declare class Navigatior {
|
|
3
|
+
/**
|
|
4
|
+
* Returns the user agent string of the browser.
|
|
5
|
+
* @returns {string} The user agent string.
|
|
6
|
+
* @example
|
|
7
|
+
* const userAgent = getUserAgent();
|
|
8
|
+
* console.log(userAgent); // Output: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.3"
|
|
9
|
+
*/
|
|
10
|
+
getUserAgent(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves high entropy User-Agent Client Hints values.
|
|
13
|
+
*
|
|
14
|
+
* This method provides access to detailed browser and platform information through the
|
|
15
|
+
* User-Agent Client Hints API. It returns a promise that resolves with the requested hints.
|
|
16
|
+
*
|
|
17
|
+
* @param {string[]} hints - Array of hint names to retrieve. Common hints include:
|
|
18
|
+
* - 'architecture': CPU architecture (e.g., 'x86', 'arm')
|
|
19
|
+
* - 'bitness': Platform bitness (e.g., '64', '32')
|
|
20
|
+
* - 'model': Device model (usually empty on desktop, populated on mobile)
|
|
21
|
+
* - 'platform': Operating system name (e.g., 'Windows', 'macOS', 'Android')
|
|
22
|
+
* - 'platformVersion': Operating system version
|
|
23
|
+
* - 'uaFullVersion': Full browser version
|
|
24
|
+
* - 'fullVersionList': Array of browser brands with full version numbers
|
|
25
|
+
* @returns {Promise<any>} Promise that resolves with an object containing the requested hint values,
|
|
26
|
+
* or undefined if the API is not supported in the current browser.
|
|
27
|
+
* @example
|
|
28
|
+
* const hints = await getHighEntropyClientHints(['model', 'platform', 'platformVersion']);
|
|
29
|
+
* console.log(hints); // Output: { model: '', platform: 'macOS', platformVersion: '13.0.0' }
|
|
30
|
+
*
|
|
31
|
+
* @note This API is only supported in Chromium-based browsers (Chrome, Edge, Opera).
|
|
32
|
+
* Firefox and Safari do not currently support User-Agent Client Hints.
|
|
33
|
+
*/
|
|
34
|
+
getHighEntropyClientHints(hints?: string[]): Promise<UADataValues | undefined>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns detailed information about the current device using UAParser.
|
|
37
|
+
*
|
|
38
|
+
* This function parses the user agent string and returns an object containing:
|
|
39
|
+
* - Full UAParser result data.
|
|
40
|
+
* - A `device` object describing the device type (e.g., mobile, tablet).
|
|
41
|
+
* - Boolean flags `isMobile` and `isTablet` to quickly identify device category.
|
|
42
|
+
*
|
|
43
|
+
* @returns {Object} An object with parsed user agent data, device info, and device type booleans.
|
|
44
|
+
*/
|
|
45
|
+
getDeviceType(): UAParserDeviceType;
|
|
46
|
+
/**
|
|
47
|
+
* Returns whether Java is enabled in the browser.
|
|
48
|
+
* @returns {boolean|string} True if Java is enabled, false if not, or "Error" if an error occurs.
|
|
49
|
+
* @example
|
|
50
|
+
* const isJavaEnabled = isJavaEnabled();
|
|
51
|
+
* console.log(isJavaEnabled); // Output: true
|
|
52
|
+
*/
|
|
53
|
+
isJavaEnabled(): boolean | string;
|
|
54
|
+
/**
|
|
55
|
+
* Returns an object with language information.
|
|
56
|
+
* @returns {{language: string, systemLanguage: string, userLanguage: string}} An object with language information.
|
|
57
|
+
* @example
|
|
58
|
+
* const languages = getLanguages();
|
|
59
|
+
* console.log(languages); // Output: { language: "en-US", systemLanguage: "en-US", userLanguage: "en-US" }
|
|
60
|
+
*/
|
|
61
|
+
getLanguages(): Language;
|
|
62
|
+
/**
|
|
63
|
+
* Checks if cookies are enabled in the browser.
|
|
64
|
+
* @returns {boolean|string} True if cookies are enabled, false if not, or "Error" if an error occurs.
|
|
65
|
+
* @example
|
|
66
|
+
* isCookieEnabled(); // Returns true or false
|
|
67
|
+
*/
|
|
68
|
+
isCookieEnabled(): boolean | string;
|
|
69
|
+
/**
|
|
70
|
+
* Check for web crawlers.
|
|
71
|
+
* @returns {boolean|string} True if crawler, false if not.
|
|
72
|
+
* @example
|
|
73
|
+
* isCookieEnabled(); // Returns true or false
|
|
74
|
+
*/
|
|
75
|
+
isCrawler(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Returns the platform of the device.
|
|
78
|
+
*
|
|
79
|
+
* @returns {string} The platform of the device.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* const platform = getPlatform();
|
|
83
|
+
* console.log(platform); // Output: "64 bits"
|
|
84
|
+
*/
|
|
85
|
+
getPlatform(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Returns an object with navigator properties.
|
|
88
|
+
* @returns {{userAgent: string, language: string, cpuClass: string, platform: string, doNotTrack: string}} An object with navigator properties.
|
|
89
|
+
* @example
|
|
90
|
+
* const navigatorProperties = getNavigatorProperties();
|
|
91
|
+
* console.log(navigatorProperties); // Output: { userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.3", language: "en-US", cpuClass: "x86_64", platform: "Win32", doNotTrack: "unspecified" }
|
|
92
|
+
*/
|
|
93
|
+
getNavigatorProperties(): {
|
|
94
|
+
userAgent: string;
|
|
95
|
+
language: string;
|
|
96
|
+
platform: string;
|
|
97
|
+
doNotTrack: string | null;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Checks whether the browser is being controlled by automation or AI agents connectes through MCP.
|
|
101
|
+
* @returns {boolean} True if the `navigator.webdriver` flag is set, false otherwise.
|
|
102
|
+
*/
|
|
103
|
+
isWebDriverEnabled(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Returns the estimated round-trip time (RTT) of the current network connection in milliseconds.
|
|
106
|
+
* For more about RTT, see: https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/rtt
|
|
107
|
+
* @returns {number} The RTT in milliseconds, or -1 if the Network Information API is not supported.
|
|
108
|
+
*/
|
|
109
|
+
getEstimatedRoundTripTime(): number;
|
|
110
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Navigatior = void 0;
|
|
13
|
+
const ua_parser_js_1 = require("ua-parser-js");
|
|
14
|
+
class Navigatior {
|
|
15
|
+
/**
|
|
16
|
+
* Returns the user agent string of the browser.
|
|
17
|
+
* @returns {string} The user agent string.
|
|
18
|
+
* @example
|
|
19
|
+
* const userAgent = getUserAgent();
|
|
20
|
+
* console.log(userAgent); // Output: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.3"
|
|
21
|
+
*/
|
|
22
|
+
getUserAgent() {
|
|
23
|
+
return navigator.userAgent;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves high entropy User-Agent Client Hints values.
|
|
27
|
+
*
|
|
28
|
+
* This method provides access to detailed browser and platform information through the
|
|
29
|
+
* User-Agent Client Hints API. It returns a promise that resolves with the requested hints.
|
|
30
|
+
*
|
|
31
|
+
* @param {string[]} hints - Array of hint names to retrieve. Common hints include:
|
|
32
|
+
* - 'architecture': CPU architecture (e.g., 'x86', 'arm')
|
|
33
|
+
* - 'bitness': Platform bitness (e.g., '64', '32')
|
|
34
|
+
* - 'model': Device model (usually empty on desktop, populated on mobile)
|
|
35
|
+
* - 'platform': Operating system name (e.g., 'Windows', 'macOS', 'Android')
|
|
36
|
+
* - 'platformVersion': Operating system version
|
|
37
|
+
* - 'uaFullVersion': Full browser version
|
|
38
|
+
* - 'fullVersionList': Array of browser brands with full version numbers
|
|
39
|
+
* @returns {Promise<any>} Promise that resolves with an object containing the requested hint values,
|
|
40
|
+
* or undefined if the API is not supported in the current browser.
|
|
41
|
+
* @example
|
|
42
|
+
* const hints = await getHighEntropyClientHints(['model', 'platform', 'platformVersion']);
|
|
43
|
+
* console.log(hints); // Output: { model: '', platform: 'macOS', platformVersion: '13.0.0' }
|
|
44
|
+
*
|
|
45
|
+
* @note This API is only supported in Chromium-based browsers (Chrome, Edge, Opera).
|
|
46
|
+
* Firefox and Safari do not currently support User-Agent Client Hints.
|
|
47
|
+
*/
|
|
48
|
+
getHighEntropyClientHints() {
|
|
49
|
+
return __awaiter(this, arguments, void 0, function* (hints = []) {
|
|
50
|
+
// Return undefined if User-Agent Client Hints API is not supported
|
|
51
|
+
if (!navigator.userAgentData) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return yield navigator.userAgentData.getHighEntropyValues(hints);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns detailed information about the current device using UAParser.
|
|
59
|
+
*
|
|
60
|
+
* This function parses the user agent string and returns an object containing:
|
|
61
|
+
* - Full UAParser result data.
|
|
62
|
+
* - A `device` object describing the device type (e.g., mobile, tablet).
|
|
63
|
+
* - Boolean flags `isMobile` and `isTablet` to quickly identify device category.
|
|
64
|
+
*
|
|
65
|
+
* @returns {Object} An object with parsed user agent data, device info, and device type booleans.
|
|
66
|
+
*/
|
|
67
|
+
getDeviceType() {
|
|
68
|
+
const parser = new ua_parser_js_1.UAParser();
|
|
69
|
+
const parserData = parser.getResult();
|
|
70
|
+
const device = parser.getDevice();
|
|
71
|
+
return Object.assign(Object.assign({}, parserData), { device: device, isMobile: (device.type && ['mobile'].includes(device.type)) || false, isTablet: (device.type && ['tablet'].includes(device.type)) || false, isDesktop: device.type === undefined ||
|
|
72
|
+
!['mobile', 'tablet'].includes(device.type) });
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Returns whether Java is enabled in the browser.
|
|
76
|
+
* @returns {boolean|string} True if Java is enabled, false if not, or "Error" if an error occurs.
|
|
77
|
+
* @example
|
|
78
|
+
* const isJavaEnabled = isJavaEnabled();
|
|
79
|
+
* console.log(isJavaEnabled); // Output: true
|
|
80
|
+
*/
|
|
81
|
+
isJavaEnabled() {
|
|
82
|
+
return navigator.javaEnabled();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns an object with language information.
|
|
86
|
+
* @returns {{language: string, systemLanguage: string, userLanguage: string}} An object with language information.
|
|
87
|
+
* @example
|
|
88
|
+
* const languages = getLanguages();
|
|
89
|
+
* console.log(languages); // Output: { language: "en-US", systemLanguage: "en-US", userLanguage: "en-US" }
|
|
90
|
+
*/
|
|
91
|
+
getLanguages() {
|
|
92
|
+
try {
|
|
93
|
+
return {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
language: navigator.language || navigator.browserLanguage || "",
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
systemLanguage: navigator.systemLanguage || "",
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
userLanguage: navigator.userLanguage || ""
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
return {
|
|
104
|
+
language: "",
|
|
105
|
+
systemLanguage: "",
|
|
106
|
+
userLanguage: ""
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Checks if cookies are enabled in the browser.
|
|
112
|
+
* @returns {boolean|string} True if cookies are enabled, false if not, or "Error" if an error occurs.
|
|
113
|
+
* @example
|
|
114
|
+
* isCookieEnabled(); // Returns true or false
|
|
115
|
+
*/
|
|
116
|
+
isCookieEnabled() {
|
|
117
|
+
let cookieEnabled;
|
|
118
|
+
try {
|
|
119
|
+
cookieEnabled = navigator.cookieEnabled || ("testcookie" in document && (document.cookie = "testcookie") && document.cookie.indexOf("testcookie") !== -1);
|
|
120
|
+
return cookieEnabled;
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
return "Error";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Check for web crawlers.
|
|
128
|
+
* @returns {boolean|string} True if crawler, false if not.
|
|
129
|
+
* @example
|
|
130
|
+
* isCookieEnabled(); // Returns true or false
|
|
131
|
+
*/
|
|
132
|
+
isCrawler() {
|
|
133
|
+
const userAgent = navigator.userAgent;
|
|
134
|
+
const crawlerUserAgents = [
|
|
135
|
+
/googlebot/i,
|
|
136
|
+
/google-read-aloud/i,
|
|
137
|
+
/bingbot/i,
|
|
138
|
+
/slurp/i, // Yahoo
|
|
139
|
+
/duckduckbot/i,
|
|
140
|
+
/baiduspider/i,
|
|
141
|
+
/yandexbot/i,
|
|
142
|
+
/sogou/i,
|
|
143
|
+
/exabot/i,
|
|
144
|
+
/facebookexternalhit/i,
|
|
145
|
+
/facebot/i,
|
|
146
|
+
/ia_archiver/i, // Alexa Crawler
|
|
147
|
+
];
|
|
148
|
+
return crawlerUserAgents.some((crawler) => crawler.test(userAgent));
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Returns the platform of the device.
|
|
152
|
+
*
|
|
153
|
+
* @returns {string} The platform of the device.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* const platform = getPlatform();
|
|
157
|
+
* console.log(platform); // Output: "64 bits"
|
|
158
|
+
*/
|
|
159
|
+
getPlatform() {
|
|
160
|
+
const strPlatform = navigator.platform.toLowerCase();
|
|
161
|
+
let strOSBits = "Unknown";
|
|
162
|
+
if (strPlatform.indexOf("x64") !== -1 ||
|
|
163
|
+
strPlatform.indexOf("wow64") !== -1 ||
|
|
164
|
+
strPlatform.indexOf("win64") !== -1 ||
|
|
165
|
+
strPlatform.indexOf("ppc") !== -1 ||
|
|
166
|
+
strPlatform.indexOf("alpha") !== -1 ||
|
|
167
|
+
strPlatform.indexOf("68k") !== -1) {
|
|
168
|
+
strOSBits = "64 bits";
|
|
169
|
+
}
|
|
170
|
+
else if (strPlatform.indexOf("win32") !== -1 ||
|
|
171
|
+
strPlatform.indexOf("x32") !== -1 ||
|
|
172
|
+
strPlatform.indexOf("x86") !== -1 ||
|
|
173
|
+
strPlatform.indexOf("iphone") !== -1 ||
|
|
174
|
+
strPlatform.indexOf("android") !== -1) {
|
|
175
|
+
strOSBits = "32 bits";
|
|
176
|
+
}
|
|
177
|
+
return strOSBits;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Returns an object with navigator properties.
|
|
181
|
+
* @returns {{userAgent: string, language: string, cpuClass: string, platform: string, doNotTrack: string}} An object with navigator properties.
|
|
182
|
+
* @example
|
|
183
|
+
* const navigatorProperties = getNavigatorProperties();
|
|
184
|
+
* console.log(navigatorProperties); // Output: { userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.3", language: "en-US", cpuClass: "x86_64", platform: "Win32", doNotTrack: "unspecified" }
|
|
185
|
+
*/
|
|
186
|
+
getNavigatorProperties() {
|
|
187
|
+
return {
|
|
188
|
+
userAgent: navigator.userAgent,
|
|
189
|
+
language: navigator.language,
|
|
190
|
+
platform: navigator.platform,
|
|
191
|
+
doNotTrack: navigator.doNotTrack,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Checks whether the browser is being controlled by automation or AI agents connectes through MCP.
|
|
196
|
+
* @returns {boolean} True if the `navigator.webdriver` flag is set, false otherwise.
|
|
197
|
+
*/
|
|
198
|
+
isWebDriverEnabled() {
|
|
199
|
+
return navigator.webdriver || false;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Returns the estimated round-trip time (RTT) of the current network connection in milliseconds.
|
|
203
|
+
* For more about RTT, see: https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/rtt
|
|
204
|
+
* @returns {number} The RTT in milliseconds, or -1 if the Network Information API is not supported.
|
|
205
|
+
*/
|
|
206
|
+
getEstimatedRoundTripTime() {
|
|
207
|
+
if (navigator.connection && typeof navigator.connection.rtt === 'number') {
|
|
208
|
+
return navigator.connection.rtt;
|
|
209
|
+
}
|
|
210
|
+
return -1;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.Navigatior = Navigatior;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observes real pointer interactions to detect touch and pen (stylus) input.
|
|
3
|
+
*/
|
|
4
|
+
export declare class PointerCapabilityDetector {
|
|
5
|
+
private static observed;
|
|
6
|
+
private static installed;
|
|
7
|
+
install(): void;
|
|
8
|
+
hasTouchOrPen(): boolean;
|
|
9
|
+
hasPen(): boolean;
|
|
10
|
+
getObserved(): {
|
|
11
|
+
touch: boolean;
|
|
12
|
+
pen: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PointerCapabilityDetector = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Observes real pointer interactions to detect touch and pen (stylus) input.
|
|
6
|
+
*/
|
|
7
|
+
class PointerCapabilityDetector {
|
|
8
|
+
install() {
|
|
9
|
+
if (PointerCapabilityDetector.installed)
|
|
10
|
+
return;
|
|
11
|
+
if (typeof window === 'undefined' || !('PointerEvent' in window))
|
|
12
|
+
return;
|
|
13
|
+
PointerCapabilityDetector.installed = true;
|
|
14
|
+
const onPointer = (event) => {
|
|
15
|
+
const pointerType = event.pointerType;
|
|
16
|
+
if (pointerType === 'pen')
|
|
17
|
+
PointerCapabilityDetector.observed.pen = true;
|
|
18
|
+
else if (pointerType === 'touch')
|
|
19
|
+
PointerCapabilityDetector.observed.touch = true;
|
|
20
|
+
// Once both modalities are seen there is nothing left to learn; detach so
|
|
21
|
+
// we are not carrying a handler on the high-frequency pointermove event.
|
|
22
|
+
if (PointerCapabilityDetector.observed.pen && PointerCapabilityDetector.observed.touch) {
|
|
23
|
+
window.removeEventListener('pointerdown', onPointer, true);
|
|
24
|
+
window.removeEventListener('pointermove', onPointer, true);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
window.addEventListener('pointerdown', onPointer, { capture: true, passive: true });
|
|
28
|
+
window.addEventListener('pointermove', onPointer, { capture: true, passive: true });
|
|
29
|
+
}
|
|
30
|
+
hasTouchOrPen() {
|
|
31
|
+
return PointerCapabilityDetector.observed.touch || PointerCapabilityDetector.observed.pen;
|
|
32
|
+
}
|
|
33
|
+
hasPen() {
|
|
34
|
+
return PointerCapabilityDetector.observed.pen;
|
|
35
|
+
}
|
|
36
|
+
getObserved() {
|
|
37
|
+
return Object.assign({}, PointerCapabilityDetector.observed);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.PointerCapabilityDetector = PointerCapabilityDetector;
|
|
41
|
+
PointerCapabilityDetector.observed = { touch: false, pen: false };
|
|
42
|
+
PointerCapabilityDetector.installed = false;
|