JavaScriptEngineSwitcher.ChakraCore.JsRt.JsValue.CallFunction C# (CSharp) Method

CallFunction() public method

Invokes a function
Requires an active script context.
public CallFunction ( ) : JsValue
return JsValue
		public JsValue CallFunction(params JsValue[] arguments)
		{
			JsValue returnReference;

			if (arguments.Length > ushort.MaxValue)
			{
				throw new ArgumentOutOfRangeException("arguments");
			}

			JsErrorHelpers.ThrowIfError(NativeMethods.JsCallFunction(this, arguments, (ushort)arguments.Length, out returnReference));

			return returnReference;
		}

Usage Example

        private static void FreezeObject(JsValue objValue)
        {
            JsValue freezeMethodValue = JsValue.GlobalObject
                                        .GetProperty("Object")
                                        .GetProperty("freeze")
            ;

            freezeMethodValue.CallFunction(objValue);
        }