Dela via


INodeInstance.InvokeExportAsync<T> Method

Definition

Asynchronously invokes code in the Node.js instance.

public:
generic <typename T>
 System::Threading::Tasks::Task<T> ^ InvokeExportAsync(System::Threading::CancellationToken cancellationToken, System::String ^ moduleName, System::String ^ exportNameOrNull, ... cli::array <System::Object ^> ^ args);
public System.Threading.Tasks.Task<T> InvokeExportAsync<T> (System.Threading.CancellationToken cancellationToken, string moduleName, string exportNameOrNull, params object[] args);
abstract member InvokeExportAsync : System.Threading.CancellationToken * string * string * obj[] -> System.Threading.Tasks.Task<'T>
Public Function InvokeExportAsync(Of T) (cancellationToken As CancellationToken, moduleName As String, exportNameOrNull As String, ParamArray args As Object()) As Task(Of T)

Type Parameters

T

The JSON-serializable data type that the Node.js code will asynchronously return.

Parameters

cancellationToken
CancellationToken

A CancellationToken that can be used to cancel the invocation.

moduleName
String

The path to the Node.js module (i.e., JavaScript file) relative to your project root that contains the code to be invoked.

exportNameOrNull
String

If set, specifies the CommonJS export to be invoked. If not set, the module's default CommonJS export itself must be a function to be invoked.

args
Object[]

Any sequence of JSON-serializable arguments to be passed to the Node.js function.

Returns

Task<T>

A Task<TResult> representing the completion of the RPC call.

Applies to