Beispiel #1
0
        internal JsContext(int id,
                           JsEngine engine,
                           Action <int> notifyDispose,
                           JsTypeDefinitionBuilder jsTypeDefBuilder)
        {
            _id            = id;
            _notifyDispose = notifyDispose;
            _engine        = engine;
            _keepalives    = new KeepAliveDictionaryStore();
            //create native js context
            _context = new HandleRef(this, jscontext_new(id, engine.UnmanagedEngineHandler));
            _convert = new JsConvert(this);

            this.jsTypeDefBuilder = jsTypeDefBuilder;

            engineMethodCallbackDel = new ManagedMethodCallDel(EngineListener_MethodCall);
            NativeV8JsInterOp.CtxRegisterManagedMethodCall(this, engineMethodCallbackDel);
            registerMethods.Add(null);    //first is null
            registerProperties.Add(null); //first is null


            proxyStore = new NativeObjectProxyStore(this);
        }
Beispiel #2
0
        internal JsContext(int id,
                           JsEngine engine,
                           Action <int> notifyDispose,
                           IntPtr nativeJsContext,
                           JsTypeDefinitionBuilder jsTypeDefBuilder)
        {
            //constructor setup
            _id            = id;
            _notifyDispose = notifyDispose;
            _engine        = engine;
            _keepalives    = new KeepAliveDictionaryStore();
            //create native js context
            _context = new HandleRef(this, nativeJsContext);
            _convert = new JsConvert(this);

            _jsTypeDefBuilder = jsTypeDefBuilder;

            _engineMethodCallbackDel = new ManagedMethodCallDel(EngineListener_MethodCall);
            NativeV8JsInterOp.CtxRegisterManagedMethodCall(this, _engineMethodCallbackDel);
            _registerMethods.Add(null);    //first is null
            _registerProperties.Add(null); //first is null
            _proxyStore = new NativeObjectProxyStore(this);
        }