Builder
class Builder
Methods
withHostFunction
fun withHostFunction(namespace: String, name: String, hostFunction: HostFunction<*>): (
namespace: String,
name: String,
hostFunction: HostFunction<*>
)
Provides a HostFunction for importing from the WasmModules in the KWasmProgram returned from build.
Parameters
Name | Description |
---|---|
namespace: String
|
|
name: String
|
|
hostFunction: HostFunction<*>
|
ReturnValue
Name | Description |
---|---|
(
namespace: String,
name: String,
hostFunction: HostFunction<*>
)
|
withHostMemory
fun withHostMemory(namespace: String, name: String, memory: Memory): (namespace: String, name: String, memory: Memory)
Provides a Memory for access by WasmModules in the KWasmProgram.
Parameters
Name | Description |
---|---|
namespace: String
|
|
name: String
|
|
memory: Memory
|
ReturnValue
Name | Description |
---|---|
(namespace: String, name: String, memory: Memory)
|
withHostGlobal
fun withHostGlobal(namespace: String, name: String, value: Number): (namespace: String, name: String, value: Number)
Provides an immutable Global for access by WasmModules in the KWasmProgram.
Parameters
Name | Description |
---|---|
namespace: String
|
|
name: String
|
|
value: Number
|
ReturnValue
Name | Description |
---|---|
(namespace: String, name: String, value: Number)
|
withHostTable
fun withHostTable(namespace: String, name: String, table: Table): (namespace: String, name: String, table: Table)
Provides a function Table for use by WasmModules in the KWasmProgram.
Parameters
Name | Description |
---|---|
namespace: String
|
|
name: String
|
|
table: Table
|
ReturnValue
Name | Description |
---|---|
(namespace: String, name: String, table: Table)
|
withModule
fun withModule(name: String, source: String): (name: String, source: String)
Parses a WasmModule from the provided source and associates it with the given name for the KWasmProgram returned from build.
Parameters
Name | Description |
---|---|
name: String
|
|
source: String
|
ReturnValue
Name | Description |
---|---|
(name: String, source: String)
|
withTextFormatModule
fun withTextFormatModule(name: String, file: File): (name: String, file: File)
Parses a text-format WasmModule from the provided file and associates it with the given name for the KWasmProgram returned from build.
Parameters
Name | Description |
---|---|
name: String
|
|
file: File
|
ReturnValue
Name | Description |
---|---|
(name: String, file: File)
|
withTextFormatModule
fun withTextFormatModule(name: String, sourceStream: InputStream): (name: String, sourceStream: InputStream)
Parses a text-format WasmModule from the provided sourceStream and associates it with the given name for the KWasmProgram returned from build.
The provided InputStream will be closed after being parsed-from.
Parameters
Name | Description |
---|---|
name: String
|
|
sourceStream: InputStream
|
ReturnValue
Name | Description |
---|---|
(name: String, sourceStream: InputStream)
|
withBinaryModule
fun withBinaryModule(name: String, file: File): (name: String, file: File)
Parses a binary-format WasmModule from the provided file and associates it with the given name for the KWasmProgram returned from build.
The provided InputStream will be closed after being parsed-from.
Parameters
Name | Description |
---|---|
name: String
|
|
file: File
|
ReturnValue
Name | Description |
---|---|
(name: String, file: File)
|
withBinaryModule
fun withBinaryModule(name: String, binaryStream: InputStream): (name: String, binaryStream: InputStream)
Parses a binary-format WasmModule from the provided binaryStream and associates it with the given name for the KWasmProgram returned from build.
The provided InputStream will be closed after being parsed-from.
Parameters
Name | Description |
---|---|
name: String
|
|
binaryStream: InputStream
|
ReturnValue
Name | Description |
---|---|
(name: String, binaryStream: InputStream)
|
Returns a KWasmProgram ready-to-use.
Allocates and Instantiates all provided modules before returning.