@cardsjd/device 0.1.11 → 0.1.13

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.
Files changed (2) hide show
  1. package/lib/device.js +13 -3
  2. package/package.json +1 -1
package/lib/device.js CHANGED
@@ -29,7 +29,17 @@ export default class Device {
29
29
  window.close();
30
30
  }
31
31
  }
32
-
32
+ getDeviceID() {
33
+ var deviceId = null;
34
+ if (this.StorageAvailable('localStorage')) {
35
+ deviceId = localStorage.getItem('deviceId');
36
+ if (!deviceId) {
37
+ deviceId = Math.floor(Math.random() * Math.floor(1000000000000));
38
+ if (this.StorageAvailable('localStorage')) localStorage.deviceId = deviceId;
39
+ }
40
+ }
41
+ return deviceId;
42
+ }
33
43
  /**
34
44
  * @returns {OSType}
35
45
  */
@@ -87,7 +97,7 @@ export default class Device {
87
97
 
88
98
  //facebook instant
89
99
  if (typeof globalThis.FBInstant !== 'undefined') {
90
- return 'FBInstant';
100
+ return 'facebook';
91
101
  }
92
102
 
93
103
  if (typeof globalThis.CrazyGames !== 'undefined') {
@@ -143,6 +153,6 @@ export default class Device {
143
153
  return 'web';
144
154
  }
145
155
 
146
- /** @typedef {'FBInstant' | 'windowsPhone' | 'windows' | 'amazon' | 'android' | 'ios' | 'steam' | 'windowsPWA' | 'web' | 'crazygames'} PlatformType */
156
+ /** @typedef {'facebook' | 'windowsPhone' | 'windows' | 'amazon' | 'android' | 'ios' | 'steam' | 'windowsPWA' | 'web' | 'crazygames'} PlatformType */
147
157
 
148
158
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cardsjd/device",
3
3
  "private": false,
4
- "version": "0.1.11",
4
+ "version": "0.1.13",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "files": [