File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @livekit/react-native ' : patch
3+ ---
4+
5+ Polyfill for DOMException to handle usage in livekit-client
Original file line number Diff line number Diff line change 11import 'well-known-symbols/Symbol.asyncIterator/auto' ;
22import 'well-known-symbols/Symbol.iterator/auto' ;
33import './polyfills/MediaRecorderShim' ;
4+ import './polyfills/DOMException' ;
45import { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc' ;
56import { setupURLPolyfill } from 'react-native-url-polyfill' ;
67import './polyfills/EncoderDecoderTogether.min.js' ;
Original file line number Diff line number Diff line change 1+ /**
2+ * DOMException is missing in some React Native / JS runtimes but is required by
3+ * web APIs (e.g. AbortController, fetch) that may be used in livekit-client.
4+ */
5+
6+ // @ts -expect-error: global may not declare DOMException in RN types.
7+ if ( typeof global . DOMException === 'undefined' ) {
8+ class PolyfillDOMException extends Error {
9+ readonly code : number ;
10+
11+ constructor ( message = '' , name ?: string ) {
12+ super ( message ) ;
13+ this . message = message ;
14+ this . name = name ?? 'Error' ;
15+ this . code = 0 ;
16+ Object . setPrototypeOf ( this , PolyfillDOMException . prototype ) ;
17+ }
18+ } ;
19+ // @ts -expect-error
20+ global . DOMException = PolyfillDOMException ;
21+ }
You can’t perform that action at this time.
0 commit comments