Method InvokeAsync
- Namespace
 - DotNetBrowser.Js
 
- Assembly
 - DotNetBrowser.dll
 
InvokeAsync(string, params object[])
Asynchronously executes the function with the given methodName and the args
in the JavaScript object without blocking the current thread.
Task<object> InvokeAsync(string methodName, params object[] args)
Parameters
methodNamestringThe function name.
argsobject[]The list of input arguments. The following types are supported: bool, double, string, IJsObject, or object.
Returns
- Task<object>
 The task that can be used to wait for completion and obtain the result of the JavaScript function execution.
Remarks
If the function raises an exception, the task will complete with JsException containing an error message that describes the reason of the exception. Same error message will be printed in JavaScript Console.
Exceptions
- ObjectDisposedException
 The IJsObject has already been disposed.
- ConnectionClosedException
 The connection to the Chromium engine is closed.
InvokeAsync<T>(string, params object[])
Asynchronously executes the function with the given methodName and the args
in the JavaScript object without blocking the current thread.
Task<T> InvokeAsync<T>(string methodName, params object[] args)
Parameters
methodNamestringThe function name.
argsobject[]The list of input arguments. The following types are supported: bool, double, string, IJsObject, or object.
Returns
- Task<T>
 The task that can be used to wait for completion and obtain the result of the JavaScript function execution.
Type Parameters
TThe expected type of the result of the JavaScript function execution.
Remarks
If the function raises an exception, the task will complete with JsException containing an error message that describes the reason of the exception. Same error message will be printed in JavaScript Console.
Exceptions
- ObjectDisposedException
 The IJsObject has already been disposed.
- ConnectionClosedException
 The connection to the Chromium engine is closed.