KFEditor adds objects to 3D scene
This commit is contained in:
+17
-2
@@ -539,7 +539,8 @@ class Loader {
|
||||
*/
|
||||
|
||||
if(typeof(crypto.randomUUID)!='function'){
|
||||
crypto.randomUUID = () => {
|
||||
crypto.randomUUID = () => {
|
||||
console.log('Polyfilled crypt !')
|
||||
var buf = new Uint8Array(14);
|
||||
crypto.getRandomValues(buf);
|
||||
var uuid = Array.from(buf, byte => ('0' + (byte & 0xFF).toString(16)).slice(-2)).join('');
|
||||
@@ -550,8 +551,22 @@ if(typeof(crypto.randomUUID)!='function'){
|
||||
uuid.substring(18,4) + '-' +
|
||||
uuid.substring(22)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
crypto.randomUUIDv7 = () => {
|
||||
const now = BigInt(Date.now())
|
||||
const time = now << 16n | BigInt(crypto.getRandomValues(new Uint16Array(1))[0])
|
||||
const bytes = new Uint8Array(16)
|
||||
new DataView(bytes.buffer).setBigUint64(0, time)
|
||||
crypto.getRandomValues(bytes.subarray(8))
|
||||
bytes[6] = (bytes[6] & 0x0f) | 0x70 // version 7
|
||||
bytes[8] = (bytes[8] & 0x3f) | 0x80 // variant
|
||||
return [...bytes].map((b,i) =>
|
||||
(b + 0x100).toString(16).substring(1) + ([3,5,7,9].includes(i) ? '-' : '')
|
||||
).join('')
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(typeof(typeof(Promise.allSettled))!='function'){
|
||||
Promise.allSettled = ((promises) => Promise.all(
|
||||
|
||||
Reference in New Issue
Block a user