Exemplo n.º 1
0
        public void OnBind(ScriptRuntime runtime, TypeRegister register)
        {
            var staticModules = runtime.FindModuleResolver <StaticModuleResolver>();

            if (staticModules != null)
            {
                staticModules.AddStaticModuleLoader("static_test1", context => QuickJS.Native.JSApi.JS_NewInt32(context, 123));
                staticModules.AddStaticModuleLoader("static_test2", context => QuickJS.Native.JSApi.JS_NewInt32(context, 456));
            }

            _mConsole.Write(LogLevel.Info, "Bind");
            QuickJS.Extra.WebSocket.Bind(register);
            QuickJS.Extra.XMLHttpRequest.Bind(register);
            if (!runtime.isWorker)
            {
                var uri = new Uri(baseUrl);
                QuickJS.Extra.DOMCompatibleLayer.Bind(register, uri);
                QuickJS.Extra.NodeCompatibleLayer.Bind(register);
            }
            _mConsole.Write(LogLevel.Info, "Bind Finish");
        }