Skip to content

Commit 447b95d

Browse files
authored
Merge pull request #108 from WebAssembly/instance-lookup
Instance lookup function for Wasm Namespaces
2 parents 7a122d6 + 87df709 commit 447b95d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

document/js-api/index.bs

Lines changed: 10 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
@@ -631,6 +632,7 @@ Note: Some implementations enforce a size limitation on |bytes|. Use of this API
631632
interface Instance {
632633
constructor(Module module, optional object importObject);
633634
readonly attribute object exports;
635+
static Instance namespaceInstance(ModuleNamespace moduleNamespace);
634636
};
635637
</pre>
636638

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

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

653663
<pre class="idl">

0 commit comments

Comments
 (0)