Exemplo n.º 1
0
 public ObjectInstance Construct(JsValue[] arguments)
 {
     try
     {
         var parameters = _engine.BuildArgs(_constructor, arguments);
         var obj        = _constructor.Invoke(parameters);
         return(_engine.GetDomNode(obj));
     }
     catch
     {
         throw new JavaScriptException(_engine.Jint.Error);
     }
 }
        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
        {
            if (_method != null && thisObject.Type == Types.Object)
            {
                var node = thisObject.AsObject() as DomNodeInstance;

                if (node != null)
                {
                    try
                    {
                        var parameters = _engine.BuildArgs(_method, arguments);
                        return(_method.Invoke(node.Value, parameters).ToJsValue(_engine));
                    }
                    catch (TargetInvocationException)
                    {
                        throw new JavaScriptException(Engine.Error);
                    }
                }
            }

            return(JsValue.Undefined);
        }