Skip to content

Commit d277f5e

Browse files
authored
Add Foreign Functions
1 parent aa2a2db commit d277f5e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/guide/functions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,13 @@ counter() // 3
230230
```
231231

232232
The `makeCounter` function returns a counter function which will print sequential numbers when called.
233+
234+
## Foreign Functions
235+
236+
A foreign function declaration can be used to import functions from the webassembly host.
237+
238+
```grain
239+
foreign wasm alert: WasmI32 => Void from "host"
240+
241+
alert(42)
242+
```

0 commit comments

Comments
 (0)