Skip to content

Commit ef477aa

Browse files
committed
use base-level namespaceInstance
1 parent 19d7635 commit ef477aa

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

document/js-api/index.bs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ namespace WebAssembly {
320320

321321
Promise<Instance> instantiate(
322322
Module moduleObject, optional object importObject);
323+
324+
Instance namespaceInstance(ModuleNamespace moduleNamespace);
323325
};
324326
</pre>
325327

@@ -331,6 +333,7 @@ Note:
331333
WebAssembly.compile(|bytes|) asynchronously validates and complies bytes of WebAssembly into a Module.
332334
WebAssembly.instantiate(|bytes|, |importObject|) asynchronously compiles and instantiates a WebAssembly module from bytes of source.
333335
The WebAssembly.instantiate(|moduleObject|, |importObject|) asynchronously instantiates a compiled module.
336+
WebAssembly.namespaceInstance(|namespace|) obtains the WebAssembly Instance from the Module Namespace Exotic Object for a WebAssembly Module Record.
334337
-->
335338

336339
<div algorithm>
@@ -538,6 +541,14 @@ The verification of WebAssembly type requirements is deferred to the
538541

539542
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>.
540543

544+
<div algorithm>
545+
The <dfn method for="WebAssembly">namespaceInstance(|namespace|)</dfn> method, when invoked, performs the following steps:
546+
1. Assert: |namespace| is a [=Module Namespace exotic object=].
547+
1. If |namespace|.\[[Module]] is not a [=WebAssembly Module Record=], [=throw=] a {{TypeError}} exception.
548+
1. Let |module| be |namespace|.\[[Module]].
549+
1. Return |module|.\[[Instance]].
550+
</div>
551+
541552
<h3 id="modules">Modules</h3>
542553

543554
<pre class="idl">
@@ -633,7 +644,6 @@ Note: Some implementations enforce a size limitation on |bytes|. Use of this API
633644
interface Instance {
634645
constructor(Module module, optional object importObject);
635646
readonly attribute object exports;
636-
static Instance namespaceInstance(ModuleNamespace moduleNamespace);
637647
};
638648
</pre>
639649

@@ -651,14 +661,6 @@ Note: The use of this synchronous API is discouraged, as some implementations so
651661
The getter of the <dfn attribute for="Instance">exports</dfn> attribute of {{Instance}} returns **this**.\[[Exports]].
652662
</div>
653663

654-
<div algorithm>
655-
The <dfn method for="Instance">namespaceInstance(|namespace|)</dfn> method, when invoked, performs the following steps:
656-
1. Assert: |namespace| is a [=Module Namespace exotic object=].
657-
1. If |namespace|.\[[Module]] is not a [=WebAssembly Module Record=], [=throw=] a {{TypeError}} exception.
658-
1. Let |module| be |namespace|.\[[Module]].
659-
1. Return |module|.\[[Instance]].
660-
</div>
661-
662664
<h3 id="memories">Memories</h3>
663665

664666
<pre class="idl">

0 commit comments

Comments
 (0)