File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff 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-
2822Or write and wait for a result - this will return all characters,
2923including 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+
3638Or more advanced usage with control of the connection
3739 - allows multiple connections
3840
You can’t perform that action at this time.
0 commit comments