Skip to content

Commit

Permalink
[js-api] Use the 'react' algorithm from WebIDL
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Oct 28, 2024
1 parent 4362b72 commit d8ef842
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,17 @@ The verification of WebAssembly type requirements is deferred to the
To <dfn>instantiate a promise of a module</dfn> |promiseOfModule| with imports |importObject|, perform the following steps:

1. Let |promise| be [=a new promise=].
1. [=Upon fulfillment=] of |promiseOfModule| with value |module|:
1. [=asynchronously instantiate a WebAssembly module|Instantiate the WebAssembly module=] |module| importing |importObject|, and let |innerPromise| be the result.
1. [=Upon fulfillment=] of |innerPromise| with value |instance|.
1. Let |result| be the {{WebAssemblyInstantiatedSource}} value «[ "{{WebAssemblyInstantiatedSource/module}}" → |module|, "{{WebAssemblyInstantiatedSource/instance}}" → |instance| ]».
1. [=Resolve=] |promise| with |result|.
1. [=Upon rejection=] of |innerPromise| with reason |reason|:
1. [=React=] to |promiseOfModule|:
* If |promiseOfModule| was fulfilled with value |module|:
1. [=asynchronously instantiate a WebAssembly module|Instantiate the WebAssembly module=] |module| importing |importObject|, and let |innerPromise| be the result.
1. [=React=] to |innerPromise|:
* If |innerPromise| was fulfilled with value |instance|.
1. Let |result| be the {{WebAssemblyInstantiatedSource}} value «[ "{{WebAssemblyInstantiatedSource/module}}" → |module|, "{{WebAssemblyInstantiatedSource/instance}}" → |instance| ]».
1. [=Resolve=] |promise| with |result|.
* If |innerPromise| was rejected with reason |reason|:
1. [=Reject=] |promise| with |reason|.
* If |promiseOfModule| was rejected with reason |reason|:
1. [=Reject=] |promise| with |reason|.
1. [=Upon rejection=] of |promiseOfModule| with reason |reason|:
1. [=Reject=] |promise| with |reason|.
1. Return |promise|.
</div>

Expand Down

0 comments on commit d8ef842

Please sign in to comment.