(module: Module, imports: ImportObject = {})
| 15 | private tables: Record<string, object> = {}; |
| 16 | |
| 17 | constructor(module: Module, imports: ImportObject = {}) { |
| 18 | this.#imports = imports; |
| 19 | |
| 20 | if (module instanceof Module) { |
| 21 | validateImports(imports, module.metadata); |
| 22 | } else { |
| 23 | throw new TypeError('Invalid module type'); |
| 24 | } |
| 25 | |
| 26 | NativeWASM.createModuleInstance(this, module, imports); |
| 27 | |
| 28 | for (const memoryName in this.memories) { |
| 29 | this.exports[memoryName] = new Memory(this.memories[memoryName]!); |
| 30 | } |
| 31 | |
| 32 | for (const tableName in this.tables) { |
| 33 | this.exports[tableName] = new Table(this.tables[tableName]!); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | function validateImports( |
nothing calls this directly
no test coverage detected