@@ -246,27 +246,35 @@ static void CreateDOMShims(IJavaScriptEngine engine, ReactContext context)
246246 {
247247 engine . SetGlobal ( "__WebSocketOriginal" , typeof ( WebSocketProxy ) ) ;
248248 engine . Execute ( @"
249- global.WebSocket = function(url, protocols) {
249+ global.WebSocket = function WebSocket (url, protocols) {
250250 protocols = protocols || [];
251251 if(typeof protocols === 'string') protocols = [protocols];
252252 if(!Array.isArray(protocols)) protocols = [];
253253 protocols = protocols.map(x => String(x));
254254
255255 return new global.__WebSocketOriginal(Context, url, protocols.join(','));
256- }" ,
257- "ReactUnity/shims/websocket"
258- ) ;
256+ }
257+
258+ global.WebSocket.CONNECTING = 0;
259+ global.WebSocket.OPEN = 1;
260+ global.WebSocket.CLOSING = 2;
261+ global.WebSocket.CLOSED = 3;
262+ " , "ReactUnity/shims/websocket" ) ;
259263 }
260264
261265 if ( ! engine . Capabilities . HasFlag ( EngineCapabilities . XHR ) )
262266 {
263267 engine . SetGlobal ( "__XMLHttpRequestOriginal" , typeof ( XMLHttpRequest ) ) ;
264268 engine . Execute ( @"
265- global.XMLHttpRequest = function() {
269+ global.XMLHttpRequest = function XMLHttpRequest () {
266270 return new global.__XMLHttpRequestOriginal(Context, location.origin);
267- }" ,
268- "ReactUnity/shims/xhr"
269- ) ;
271+ }
272+ global.XMLHttpRequest.UNSENT = 0;
273+ global.XMLHttpRequest.OPENED = 1;
274+ global.XMLHttpRequest.HEADERS_RECEIVED = 2;
275+ global.XMLHttpRequest.LOADING = 3;
276+ global.XMLHttpRequest.DONE = 4;
277+ " , "ReactUnity/shims/xhr" ) ;
270278 engine . SetGlobal ( "FormData" , typeof ( FormData ) ) ;
271279 }
272280
0 commit comments