Skip to content

Commit 3e70ac4

Browse files
committed
support separate instance lookup function
1 parent 7a122d6 commit 3e70ac4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

document/js-api/index.bs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
8080
text: Cyclic Module Record; url: cyclic-module-record
8181
text: GetMethod; url: sec-getmethod
8282
text: ToBigInt64; url: #sec-tobigint64
83+
text: Module Namespace exotic object; url: #sec-module-namespace-exotic-objects
8384
type: abstract-op
8485
text: CreateDataPropertyOrThrow; url: sec-createdatapropertyorthrow
8586
text: CreateMethodProperty; url: sec-createmethodproperty
@@ -318,6 +319,8 @@ namespace WebAssembly {
318319

319320
Promise<Instance> instantiate(
320321
Module moduleObject, optional object importObject);
322+
323+
Instance moduleInstance(ModuleNamespace namespace);
321324
};
322325
</pre>
323326

@@ -534,6 +537,14 @@ The verification of WebAssembly type requirements is deferred to the
534537
1. [=asynchronously instantiate a WebAssembly module|Asynchronously instantiate the WebAssembly module=] |moduleObject| importing |importObject|, and return the result.
535538
</div>
536539

540+
<div algorithm>
541+
The <dfn method for="WebAssembly">moduleInstance(|namespace|)</dfn> method, when invoked, performs the following steps:
542+
1. If |namespace| is not a [=is a Module Namespace exotic object=], [=throw=] a {{TypeError}} exception.
543+
1. If |namespace|.\[[Module]] is not a [=WebAssembly Module Record=], [=throw=] a {{TypeError}} exception.
544+
1. Let |module| be |namespace|.\[[Module]].
545+
1. Return |module|.\[[Instance]].
546+
</div>
547+
537548
Note: A follow-on streaming API is documented in the <a href="https://webassembly.github.io/spec/web-api/index.html">WebAssembly Web API</a>.
538549

539550
<h3 id="modules">Modules</h3>

0 commit comments

Comments
 (0)