Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactivexcomponent.js",
"version": "7.0.7",
"version": "7.0.8",
"description": "Javascript reactive client API for XComponent",
"module": "dist/index.js",
"main": "dist/index.js",
Expand Down
11 changes: 10 additions & 1 deletion src/utils/uuid.ts
Original file line number Diff line number Diff line change
@@ -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)
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c: string): string {
const r = Math.floor(Math.random() * 16); // évite l'opérateur bitwise
const v = c === 'x' ? r : (r % 4) + 8; // remplace (r & 0x3 | 0x8)
return v.toString(16);
});
}