WasmComponentInstance Class
An instance of a component, or an instance exported by a component: its exports.
public sealed class WasmComponentInstanceProperties
| Name | Description |
|---|---|
| Exports | Gets the names and the kinds of the exports. |
Exports
WasmComponent.csGets the names and the kinds of the exports.
public IReadOnlyList<WasmComponentImport> Exports { get; }Property value
Methods
| Name | Description |
|---|---|
| GetFunction(string) | Returns an exported function, or null. A name of the form instance#function (such as wasi:cli/run@0.2.0#run) is a function of an exported instance. |
| GetInstance(string) | Returns an exported instance, or null. |
| GetType(string) | Returns an exported type (such as a resource type), or null. |
| Run<T>(Func<Task<T>>) | Runs an asynchronous operation of the host on the current thread, as the thread of the store, and returns its result: while the operation waits for the components (the values of their streams and futures, the tasks that continue after a call returns), the store runs them, and the continuations of the operation run on this thread. The operation can call the functions of the components and use their streams. |
GetFunction(string)
WasmComponent.csReturns an exported function, or null. A name of the form instance#function (such as wasi:cli/run@0.2.0#run) is a function of an exported instance.
public ComponentFunction? GetFunction(string name)GetInstance(string)
WasmComponent.csReturns an exported instance, or null.
public WasmComponentInstance? GetInstance(string name)GetType(string)
WasmComponent.csReturns an exported type (such as a resource type), or null.
public ComponentType? GetType(string name)Run<T>(Func<Task<T>>)
WasmComponent.csRuns an asynchronous operation of the host on the current thread, as the thread of the store, and returns its result: while the operation waits for the components (the values of their streams and futures, the tasks that continue after a call returns), the store runs them, and the continuations of the operation run on this thread. The operation can call the functions of the components and use their streams.
Type parameters
T- The type of the result.
Parameters
operationFunc<Task<T>>- The operation.
Returns
T The result of the operation.
Exceptions
WasmTrapException- A component trapped, or the components cannot complete the operation (a deadlock).
PlatformNotSupportedException- The operation waits for the host on the browser.