Skip to content

Commit 443b99b

Browse files
authored
Update docs
1 parent 15ad9c4 commit 443b99b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

puck.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ Execute expression and return the result:
1919
alert(d);
2020
});
2121
22-
As a promise:
23-
24-
Puck.eval("BTN.read()").then(function(d) {
25-
alert(d);
26-
})
27-
2822
Or write and wait for a result - this will return all characters,
2923
including echo and linefeed from the REPL so you may want to send
3024
`echo(0)` and use `console.log` when doing this.
@@ -33,6 +27,14 @@ including echo and linefeed from the REPL so you may want to send
3327
alert(d);
3428
});
3529
30+
Both `eval` and `write` will return a promise if no callback
31+
function is given as an argument.
32+
33+
alert( await Puck.eval("BTN.read()") )
34+
35+
alert( await Puck.write("1+2\n") )
36+
37+
3638
Or more advanced usage with control of the connection
3739
- allows multiple connections
3840

0 commit comments

Comments
 (0)