Example #1
0
        void CreateLocation(Jint.Engine engine, ReactScript script)
        {
            var location = new DomProxies.Location(script.SourceLocation, Restart);

            engine.SetValue("location", location);

#if UNITY_EDITOR
            engine.SetValue("WebSocket", typeof(WebSocketProxy));
            engine.SetValue("oldXMLHttpRequest", typeof(XMLHttpRequest));
            engine.Execute(@"XMLHttpRequest = function() { return new oldXMLHttpRequest('" + location.origin + @"'); }");
#endif
            engine.SetValue("document", new DocumentProxy(unityContext, this, location.origin));
        }
Example #2
0
        void CreateLocation(Jint.Engine engine)
        {
            var location = new DomProxies.Location(context);

            engine.SetValue("location", location);

#if UNITY_EDITOR || REACT_DEV_SERVER_API
            engine.SetValue("ctx", context);
            engine.SetValue("oldWebSocket", typeof(WebSocketProxy));
            engine.Execute(@"WebSocket = function() { return new oldWebSocket(ctx, ...arguments); }");
            engine.SetValue("oldXMLHttpRequest", typeof(XMLHttpRequest));
            engine.Execute(@"XMLHttpRequest = function() { return new oldXMLHttpRequest('" + location.origin + @"'); }");
#endif
            engine.SetValue("document", new DocumentProxy(context, this.ExecuteScript, location.origin));
        }