Exemplo n.º 1
0
        private void StartV8(SceneGraphNode root)
        {
            // ensure v8.net dependencies are fine for instantiation of V8Engine
            deps();

            v8 = new V8Engine();
            v8.RegisterType(typeof(X3DConsole), null, true, ScriptMemberSecurity.Locked);

            // Scene Access Interface
            // See: http://www.web3d.org/documents/specifications/19775-2/V3.3/Part02/servRef.html

            HookTypeSystem();

            v8.GlobalObject.SetProperty("console", X3DConsole.Current);
            v8.GlobalObject.SetProperty("document", root);

            v8.DynamicGlobalObject.window  = v8.CreateFunctionTemplate("window").GetFunctionObject <WindowFunction>();
            v8.DynamicGlobalObject.browser = v8.CreateFunctionTemplate("browser").GetFunctionObject <BrowserFunction>();


            MapKeyValues();

            Console.WriteLine("X3D Scripting [enabled]");
        }
Exemplo n.º 2
0
 private V8Function GetFunctionWrapper(JSFunction callback)
 {
     return(_engine.CreateFunctionTemplate().GetFunctionObject(callback));
 }