MCPcopy Create free account
hub / github.com/esengine/esengine / generateGUID

Function generateGUID

packages/core/src/Utils/GUID.ts:25–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23 * ```
24 */
25export function generateGUID(): string {
26 // 优先使用原生 crypto API(浏览器和 Node.js 19+)
27 if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
28 return crypto.randomUUID();
29 }
30
31 // 降级方案:使用 crypto.getRandomValues 或 Math.random
32 return generateGUIDFallback();
33}
34
35/**
36 * 降级 GUID 生成实现

Callers 2

constructorMethod · 0.90
createAssetMetaFunction · 0.85

Calls 1

generateGUIDFallbackFunction · 0.85

Tested by

no test coverage detected