@hive-p2p/browser 1.0.82 → 1.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/config.mjs CHANGED
@@ -1,5 +1,10 @@
1
+ if (typeof window === 'undefined' && typeof self !== 'undefined') {
2
+ globalThis.window = self; // PATCH THE WINDOW OBJECT FOR SIMPLEPEER
3
+ //globalThis.document = {};
4
+ }
5
+
1
6
  const isNode = typeof self === 'undefined';
2
- //if (!isNode) (await import('../libs/simplepeer-9.11.1.min.js')).default;
7
+ if (!isNode) (await import('../libs/simplepeer-9.11.1.min.js')).default;
3
8
 
4
9
  // HOLD: GLOBAL CONFIG FOR THE LIBRARY
5
10
  // AVOID: CIRCULAR DEPENDENCIES AND TOO MANY FUNCTION/CONSTRUCTOR CONFIG
@@ -108,8 +113,8 @@ export const TRANSPORTS = {
108
113
 
109
114
  WS_CLIENT: WebSocket,
110
115
  WS_SERVER: isNode ? (await import('ws')).WebSocketServer : null,
111
- //PEER: isNode ? (await import('simple-peer')).default : window.SimplePeer
112
- PEER: (await import('simple-peer')).default,
116
+ PEER: isNode ? (await import('simple-peer')).default : globalThis.window.SimplePeer
117
+ //PEER: (await import('simple-peer')).default,
113
118
  }
114
119
 
115
120
  export const DISCOVERY = {