Files
FrenoCorp/node_modules/isomorphic.js/browser.mjs
Michael Freno 7c684a42cc FRE-600: Fix code review blockers
- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-25 00:08:01 -04:00

26 lines
711 B
JavaScript

/* eslint-env browser */
export const performance = typeof window === 'undefined' ? null : (typeof window.performance !== 'undefined' && window.performance) || null
const isoCrypto = typeof crypto === 'undefined' ? null : crypto
/**
* @type {function(number):ArrayBuffer}
*/
export const cryptoRandomBuffer = isoCrypto !== null
? len => {
// browser
const buf = new ArrayBuffer(len)
const arr = new Uint8Array(buf)
isoCrypto.getRandomValues(arr)
return buf
}
: len => {
// polyfill
const buf = new ArrayBuffer(len)
const arr = new Uint8Array(buf)
for (let i = 0; i < len; i++) {
arr[i] = Math.ceil((Math.random() * 0xFFFFFFFF) >>> 0)
}
return buf
}