-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigator.js
55 lines (48 loc) · 1.48 KB
/
navigator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import './locks.js';
import './share.js';
import './appBadge.js';
if (! Navigator.prototype.hasOwnProperty('pdfViewerEnabled')) {
Object.defineProperty(navigator, 'pdfViewerEnabled', {
enumerable: true,
configurable: false,
writable: false,
value: false,
});
}
if (! (Navigator.prototype.getInstalledRelatedApps instanceof Function)) {
Navigator.prototype.getInstalledRelatedApps = async () => [];
}
if (! (Navigator.prototype.getGamepads instanceof Function)) {
Navigator.prototype.getGamepads = () => [];
}
if (! ('hardwareConcurrency' in Navigator.prototype)) {
Object.defineProperty(Navigator.prototype, 'hardwareConcurrency', {
get: () => 1,
});
}
if (! ('connection' in Navigator.prototype)) {
Object.defineProperty(Navigator.prototype, 'connection', {
get: () => Object.create(EventTarget.prototype, {
type: { value: 'unknown' },
effectiveType: { value: '4g' },
rtt: { value: NaN },
downlink: { value: NaN },
downlinkMax: { value: Infinity },
saveData: { value: false },
onchange: { value: null, writable: true },
ontypechange: { value: null, writable: true },
})
});
} else if (! ('type' in navigator.connection)) {
navigator.connection.type = 'unknown';
}
if (! ('doNotTrack' in Navigator.prototype)) {
Object.defineProperty(Navigator.prototype, 'doNotTrack', {
get: () => 'unspecified',
});
}
if (! ('globalPrivacyControl' in Navigator.prototype)) {
Object.defineProperty(Navigator.prototype, 'globalPrivacyControl', {
get: () => false,
});
}