Method InvokeAsync
- Namespace
- DotNetBrowser.Js
- Assembly
- DotNetBrowser.dll
InvokeAsync(IJsObject, params object[])
Asynchronously executes the function on the given jsObject with the args
without blocking the current thread.
Task<object> InvokeAsync(IJsObject jsObject, params object[] args)
Parameters
jsObjectIJsObjectThe JavaScript object to invoke this function on. Pass
nullto invoke the function as a global function.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 will be thrown. Same error message will be printed in JavaScript Console.
Exceptions
- ObjectDisposedException
The IJsFunction has already been disposed.
- ConnectionClosedException
The connection to the Chromium engine is closed.
InvokeAsync<T>(IJsObject, params object[])
Asynchronously executes the function on the given jsObject with the args
without blocking the current thread.
Task<T> InvokeAsync<T>(IJsObject jsObject, params object[] args)
Parameters
jsObjectIJsObjectThe JavaScript object to invoke this function on. Pass
nullto invoke the function as a global function.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 IJsFunction has already been disposed.
- ConnectionClosedException
The connection to the Chromium engine is closed.