Пример #1
0
        public ClrPrototype(global::Jint.Engine engine, DomConverter converter, Type type, ObjectInstance prototype) :
            base(engine)
        {
            Prototype  = prototype;
            _name      = (type.GetCustomAttribute <JsNameAttribute>()?.Name ?? type.Name) + "Prototype";
            Extensible = true;

            converter.DefineProperties(this, type);
        }
Пример #2
0
        public JintJsEngine(object global)
        {
            _typeConverter = new DomConverter(() => _engine);

            _engine = new Engine(o => o.AddObjectConverter(_typeConverter));

            if (global != null)
            {
                _typeConverter.SetGlobal(global);
                _typeConverter.DefineProperties(_engine.Global, global.GetType());
            }
        }