internal JsContext(int id, JsEngine engine, IntPtr engineHandle, Action<int> notifyDispose)
        {
            _id = id;
            _engine = engine;
            _notifyDispose = notifyDispose;

            _keepalives = new KeepAliveDictionaryStore();
            _context = jscontext_new(id, engineHandle);
            _convert = new JsConvert(this);
        }
Exemple #2
0
        public JsEngine()
        {
            _keepalives = new KeepAliveDictionaryStore();

            _keepalive_remove = new KeepaliveRemoveDelegate(KeepAliveRemove);
            _keepalive_get_property_value = new KeepAliveGetPropertyValueDelegate(KeepAliveGetPropertyValue);
            _keepalive_set_property_value = new KeepAliveSetPropertyValueDelegate(KeepAliveSetPropertyValue);
            _keepalive_invoke = new KeepAliveInvokeDelegate(KeepAliveInvoke);

            _engine = new HandleRef(this, jsengine_new(
                _keepalive_remove,
                _keepalive_get_property_value, _keepalive_set_property_value,
                _keepalive_invoke));

            _convert = new JsConvert(this);
        }
Exemple #3
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);
        }