DefaultSimpleWasmModuleLoader class final

用于支持 Simple 扩展在 Web 上正常运行的默认加载器实现,主要职责如下:

  1. WebAssembly.instantiateStreaming(source, importObject) 模块实例化时,将所需的宿主侧能力通过 importObject 提供给模块用于运行期调用。
  2. 在模块实例化后,将模块导出的线性内存交由宿主侧,以供文件读写。

Constructors

DefaultSimpleWasmModuleLoader({Map<String, Uint8List> files = const {}})
创建用于支持 Simple 扩展在 Web 上正常运行的默认加载器。

Properties

files Map<String, Uint8List>
获取当前可供 Wasm 模块读取的路径及其字节内容
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createImportObject() JSObject
Creates a JavaScript object providing definitions used as imported functions by the WebAssembly module.
instantiateModule(Response response) Future<WebAssemblyInstantiatedSource>
Instantiates a module by calling WebAssembly.instantiateStreaming with the response and createImportObject.
loadModule(Response response) Future<Instance>
Load and instantiate a WebAssembly module from a fetch response by providing host imports.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateFiles(Map<String, Uint8List> apply(Map<String, Uint8List> files)) → void
更新 Wasm 模块读写的文件。

Operators

operator ==(Object other) bool
The equality operator.
inherited