Ejemplo n.º 1
0
        public static JsObject BuildDelegateFunction(JsGlobal global, Delegate @delegate)
        {
            if (global == null)
                throw new ArgumentNullException("global");
            if (@delegate == null)
                throw new ArgumentNullException("delegate");

            return global.CreateFunction(
                @delegate.Method.Name,
                WrapDelegate(@delegate),
                @delegate.Method.GetParameters().Length
            );
        }
Ejemplo n.º 2
0
        public static JsObject BuildMethodFunction(JsGlobal global, MethodInfo method)
        {
            if (method == null)
                throw new ArgumentNullException("method");
            if (global == null)
                throw new ArgumentNullException("global");
            if (method.ContainsGenericParameters)
                throw new InvalidOperationException("Can't wrap an unclosed generic");

            return global.CreateFunction(
                method.Name,
                WrapMethod(method),
                method.GetParameters().Length
            );
        }