You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/esm-integration/EXAMPLES.md
+13-4
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,15 @@ export const count = new WebAssembly.Global({
81
81
}, 42);
82
82
```
83
83
84
+
Note that counter.js could equivalently be written:
85
+
86
+
```js
87
+
// counter.js
88
+
exportlet count =42;
89
+
```
90
+
91
+
Which would still be picked up as a global import value, although changes to the JS value would not affect the WebAssembly global value (live bindings are only supported for Wasm module exports).
92
+
84
93
##### External type imports
85
94
86
95
```wasm
@@ -109,7 +118,7 @@ for (let index = 0; index < length; index++)
109
118
110
119
| export type | imported value |
111
120
|-------------|---------------------------|
112
-
| global |`WebAssembly.Global` object|
121
+
| global |The corresponding JS value for the global|
113
122
| memory |`WebAssembly.Memory` object |
114
123
| table |`WebAssembly.Table` object |
115
124
| function | WebAssembly exported function |
@@ -123,16 +132,16 @@ Wasm bindings cannot be reassigned as it can in JS, so the exported value will n
123
132
1. wasm module is instantiated evaluated. Functions are initialized. Memories and tables are initialized and filled with data/elem sections. Globals are initialized and initializer expressions are evaluated. The start function runs.
124
133
1. JS module is evaluated. All values are available.
125
134
126
-
Currently, the value of the export for something like `WebAssembly.Global`would be accessed using the `.value` property on the JS object. However, when host bindings are in place, these could be annotated with a host binding that turns it into a real live binding that points directly to the value's address.
135
+
The value of the export for `WebAssembly.Global`is provided directly on the JS namespace object, with mutable globals reflected as live bindings to JS.
Copy file name to clipboardExpand all lines: proposals/esm-integration/README.md
+1-2
Original file line number
Diff line number
Diff line change
@@ -199,5 +199,4 @@ If custom compilation options are needed or if custom streams need to be provide
199
199
200
200
### Where is the specification for this proposal?
201
201
202
-
If you want to dig into the details, see [the updated WebAssembly JS API](https://webassembly.github.io/esm-integration/js-api/index.html#esm-integration) and [the proposed HTML integration PR](https://github.com/whatwg/html/pull/4372).
203
-
202
+
If you want to dig into the details, see [the updated WebAssembly JS API](https://webassembly.github.io/esm-integration/js-api/index.html#esm-integration) and [th HTML integration PR](https://github.com/whatwg/html/pull/10380).
0 commit comments