We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 90bd8b1 + 929f4fb commit 4843332Copy full SHA for 4843332
2 files changed
package.json
@@ -1,6 +1,6 @@
1
{
2
"name": "reactivexcomponent.js",
3
- "version": "7.0.7",
+ "version": "7.0.8",
4
"description": "Javascript reactive client API for XComponent",
5
"module": "dist/index.js",
6
"main": "dist/index.js",
src/utils/uuid.ts
@@ -1,3 +1,12 @@
export function generateUUID(): string {
- return crypto.randomUUID();
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
+ return crypto.randomUUID();
+ }
+
+ // Fallback (non cryptographique)
7
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c: string): string {
8
+ const r = Math.floor(Math.random() * 16); // évite l'opérateur bitwise
9
+ const v = c === 'x' ? r : (r % 4) + 8; // remplace (r & 0x3 | 0x8)
10
+ return v.toString(16);
11
+ });
12
}
0 commit comments