示例#1
0
        public JSContext(JSRuntimePtr runtime)
        {
            Runtime = runtime;

            Pointer = JSAPI.NewContext(runtime, 8192);
            if (Pointer.IsZero)
            {
                throw new Exception();
            }

            Exception = new JSContextExceptionStatus(Pointer);
            WeakSelf  = new WeakReference(this, true);

            if (!ContextRegistry.TryAdd(Pointer, WeakSelf))
            {
                throw new Exception("Failed to update context registry");
            }
        }