@@ -246,27 +246,35 @@ static void CreateDOMShims(IJavaScriptEngine engine, ReactContext context)
246
246
{
247
247
engine . SetGlobal ( "__WebSocketOriginal" , typeof ( WebSocketProxy ) ) ;
248
248
engine . Execute ( @"
249
- global.WebSocket = function(url, protocols) {
249
+ global.WebSocket = function WebSocket (url, protocols) {
250
250
protocols = protocols || [];
251
251
if(typeof protocols === 'string') protocols = [protocols];
252
252
if(!Array.isArray(protocols)) protocols = [];
253
253
protocols = protocols.map(x => String(x));
254
254
255
255
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" ) ;
259
263
}
260
264
261
265
if ( ! engine . Capabilities . HasFlag ( EngineCapabilities . XHR ) )
262
266
{
263
267
engine . SetGlobal ( "__XMLHttpRequestOriginal" , typeof ( XMLHttpRequest ) ) ;
264
268
engine . Execute ( @"
265
- global.XMLHttpRequest = function() {
269
+ global.XMLHttpRequest = function XMLHttpRequest () {
266
270
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" ) ;
270
278
engine . SetGlobal ( "FormData" , typeof ( FormData ) ) ;
271
279
}
272
280
0 commit comments