Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit 3a9c4ae

Browse files
committed
Update link to WebIDL bindings
Closes rustwasm/rustwasm.github.io#162
1 parent 9575cb5 commit 3a9c4ae

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/game-of-life/implementing.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ JavaScript's garbage-collected heap — where `Object`s, `Array`s, and DOM nodes
3535
are allocated — is distinct from WebAssembly's linear memory space, where our
3636
Rust values live. WebAssembly currently has no direct access to the
3737
garbage-collected heap (as of April 2018, this is expected to change with the
38-
["host bindings" proposal][host-bindings]). JavaScript, on the other hand, can
38+
["WebIDL bindings" proposal][webidl-bindings]). JavaScript, on the other hand, can
3939
read and write to the WebAssembly linear memory space, but only as an
4040
[`ArrayBuffer`][array-buf] of scalar values (`u8`, `i32`, `f64`,
4141
etc...). WebAssembly functions also take and return scalar values. These are the
4242
building blocks from which all WebAssembly and JavaScript communication is
4343
constituted.
4444

45-
[host-bindings]: https://github.com/WebAssembly/host-bindings/blob/master/proposals/host-bindings/Overview.md
45+
[webidl-bindings]: https://github.com/WebAssembly/webidl-bindings/blob/master/proposals/webidl-bindings/Explainer.md
4646
[array-buf]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
4747

4848
`wasm_bindgen` defines a common understanding of how to work with compound
@@ -609,21 +609,21 @@ encourage you to go learn about hashlife on your own!
609609
<details>
610610
<summary>Answer</summary>
611611
*First, add `js-sys` as a dependency in `wasm-game-of-life/Cargo.toml`:*
612-
612+
613613
```toml
614614
# ...
615615
[dependencies]
616616
js-sys = "0.3"
617617
# ...
618618
```
619-
619+
620620
*Then, use the `js_sys::Math::random` function to flip a coin:*
621-
621+
622622
```rust
623623
extern crate js_sys;
624-
624+
625625
// ...
626-
626+
627627
if js_sys::Math::random() < 0.5 {
628628
// Alive...
629629
} else {
@@ -658,9 +658,9 @@ encourage you to go learn about hashlife on your own!
658658
cells: FixedBitSet,
659659
}
660660
```
661-
661+
662662
The Universe constructor can be adjusted the following way:
663-
663+
664664
```rust
665665
pub fn new() -> Universe {
666666
let width = 64;

0 commit comments

Comments
 (0)