@opendaw/lib-dom 0.0.27 → 0.0.28
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/dist/browser.d.ts +1 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +14 -0
- package/package.json +4 -4
package/dist/browser.d.ts
CHANGED
package/dist/browser.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAIA,yBAAiB,OAAO,CAAC;IAGd,MAAM,WAAW,eAA2D,CAAA;IAC5E,MAAM,OAAO,eAAiE,CAAA;IAC9E,MAAM,SAAS,eAAgE,CAAA;IAC/E,MAAM,SAAS,eAA8E,CAAA;IAC7F,MAAM,KAAK,eAAsB,CAAA;IACjC,MAAM,QAAQ,SAAmE,CAAA;IACjF,MAAM,UAAU,eAA8B,CAAA;IAC9C,MAAM,SAAS,QAMH,CAAA;IACZ,MAAM,EAAE,cAQd,CAAA;CACJ"}
|
package/dist/browser.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
// noinspection PlatformDetectionJS
|
2
|
+
import { isDefined, UUID } from "@opendaw/lib-std";
|
2
3
|
export var Browser;
|
3
4
|
(function (Browser) {
|
4
5
|
const hasLocation = typeof self !== "undefined" && "location" in self && typeof self.location !== undefined;
|
@@ -17,4 +18,17 @@ export var Browser;
|
|
17
18
|
.replace(/\bSafari\/[\d.]+\s*/g, "")
|
18
19
|
.replace(/\s+/g, " ")
|
19
20
|
.trim() : "N/A";
|
21
|
+
Browser.id = () => {
|
22
|
+
if (!hasLocation) {
|
23
|
+
return "";
|
24
|
+
}
|
25
|
+
const key = "__id__";
|
26
|
+
const id = localStorage.getItem(key);
|
27
|
+
if (isDefined(id)) {
|
28
|
+
return id;
|
29
|
+
}
|
30
|
+
const newID = UUID.toString(UUID.generate());
|
31
|
+
localStorage.setItem(key, newID);
|
32
|
+
return newID;
|
33
|
+
};
|
20
34
|
})(Browser || (Browser = {}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@opendaw/lib-dom",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.28",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"types": "./dist/index.d.ts",
|
6
6
|
"license": "LGPL-3.0-or-later",
|
@@ -22,13 +22,13 @@
|
|
22
22
|
"test": "vitest run"
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
|
-
"@opendaw/lib-runtime": "^0.0.
|
26
|
-
"@opendaw/lib-std": "^0.0.
|
25
|
+
"@opendaw/lib-runtime": "^0.0.28",
|
26
|
+
"@opendaw/lib-std": "^0.0.28",
|
27
27
|
"@types/wicg-file-system-access": "^2023.10.6"
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
30
|
"@opendaw/eslint-config": "^0.0.19",
|
31
31
|
"@opendaw/typescript-config": "^0.0.20"
|
32
32
|
},
|
33
|
-
"gitHead": "
|
33
|
+
"gitHead": "ef80742a992e09362277ff87ec1b79ded515f9e5"
|
34
34
|
}
|