InvokeJSFunctionAsync Method
Invoke JavaScript function from JSFunction object.
In some cases, from the browser JavaScript side, try using the C# JavaScript function with function type argument, such as:
RegisterJSFunction("csharpExecCallback", callback => InvokeJSFunctionAsync(callback, "TestResult"));
Thus, the browser javascript side can call:
window.csharpExecCallback(function(result) { console.log(result); });
Syntax
'Declaration Public Function InvokeJSFunctionAsync( _ ByVal jsFunctionInstance As Object, _ ByVal ParamArray arguments() As Object _ ) As Task(Of Object)
'Usage Dim instance As WebControl Dim jsFunctionInstance As Object Dim arguments() As Object Dim value As Task(Of Object) value = instance.InvokeJSFunctionAsync(jsFunctionInstance, arguments)
public Task<object> InvokeJSFunctionAsync( object jsFunctionInstance, params object[] arguments )
public: Task<Object^>^ InvokeJSFunctionAsync( Object^ jsFunctionInstance, ... array<Object^>^ arguments )
Parameters
- jsFunctionInstance
- JSFunction object instance.
- arguments
- Execution arguments.
Return Value
Execution result.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also