private void FreezeObject(EdgeJsValue objValue) { EdgeJsValue freezeMethodValue = EdgeJsValue.GlobalObject .GetProperty("Object") .GetProperty("freeze") ; freezeMethodValue.CallFunction(objValue); }
public override object CallFunction(string functionName, params object[] args) { object result = InvokeScript(() => { EdgeJsValue globalObj = EdgeJsValue.GlobalObject; EdgeJsPropertyId functionId = EdgeJsPropertyId.FromString(functionName); bool functionExist = globalObj.HasProperty(functionId); if (!functionExist) { throw new JsRuntimeException( string.Format(CommonStrings.Runtime_FunctionNotExist, functionName)); } EdgeJsValue resultValue; EdgeJsValue functionValue = globalObj.GetProperty(functionId); if (args.Length > 0) { EdgeJsValue[] processedArgs = MapToScriptType(args); foreach (EdgeJsValue processedArg in processedArgs) { AddReferenceToValue(processedArg); } EdgeJsValue[] allProcessedArgs = new[] { globalObj }.Concat(processedArgs).ToArray(); resultValue = functionValue.CallFunction(allProcessedArgs); foreach (EdgeJsValue processedArg in processedArgs) { RemoveReferenceToValue(processedArg); } } else { resultValue = functionValue.CallFunction(globalObj); } return(MapToHostType(resultValue)); }); return(result); }