@@ -190,7 +190,7 @@ window.ship = "zod";
190include this file like:
190include this file like:
193−<script src="/session.js"></script>
193+<script src="/session.js"></script>
196Then you need to set the `ship` field in the `Urbit` object. You would typically
196Then you need to set the `ship` field in the `Urbit` object. You would typically
@@ -275,14 +275,14 @@ Here's a simple example that will run `authenticate` for a fakezod when the
275_Connect_ button is pressed:
275_Connect_ button is pressed:
279− <head>
279+ <head>
280− <script src="https://unpkg.com/@urbit/http-api"></script>
280+ <script src="https://unpkg.com/@urbit/http-api"></script>
281− </head>
281+ </head>
282− <body>
282+ <body>
283− <button id="start" type="button" onClick="connect()" >Connect</button>
283+ <button id="start" type="button" onClick="connect()" >Connect</button>
284− </body>
284+ </body>
285− <script>
285+ <script>
286 async function connect() {
286 async function connect() {
287 window.api = await UrbitHttpApi.Urbit.authenticate({
287 window.api = await UrbitHttpApi.Urbit.authenticate({
288 ship: "zod",
288 ship: "zod",
@@ -292,8 +292,8 @@ _Connect_ button is pressed:
293 document.body.innerHTML = "Connected!";
293 document.body.innerHTML = "Connected!";
295− </script>
295+ </script>
296−</html>
296+</html>
299`window.api` can then be used for further communications.
299`window.api` can then be used for further communications.
@@ -325,17 +325,17 @@ reason the `hood` agent rejects the poke, "Poke failed!" will be displayed on
329− <head>
329+ <head>
330− <script src="https://unpkg.com/@urbit/http-api"></script>
330+ <script src="https://unpkg.com/@urbit/http-api"></script>
331− <script src="/session.js"></script>
331+ <script src="/session.js"></script>
332− </head>
332+ </head>
333− <body>
333+ <body>
334− <input id="msg" type="text" placeholder="Message for ship" />
334+ <input id="msg" type="text" placeholder="Message for ship" />
335− <button id="submit" type="button" onClick="doPoke()" >Submit</button>
335+ <button id="submit" type="button" onClick="doPoke()" >Submit</button>
336− <p id="err"></p>
336+ <p id="err"></p>
337− </body>
337+ </body>
338− <script>
338+ <script>
339 document.getElementById("msg")
339 document.getElementById("msg")
340 .addEventListener("keyup", function(event) {
340 .addEventListener("keyup", function(event) {
341 if (event.keyCode === 13) {
341 if (event.keyCode === 13) {
@@ -362,8 +362,8 @@ the page.
362 document.getElementById("msg").value = "";
362 document.getElementById("msg").value = "";
363 document.getElementById("err").innerHTML = "Poke failed!";
363 document.getElementById("err").innerHTML = "Poke failed!";
365− </script>
365+ </script>
366−</html>
366+</html>
369### Subscribe and Unsubscribe {#subscribe}
369### Subscribe and Unsubscribe {#subscribe}
@@ -401,16 +401,16 @@ update it receives. You can test it by doing something like posting a message in
401a chat. You can also unsubscribe by clicking the "Unsubscribe" button.
401a chat. You can also unsubscribe by clicking the "Unsubscribe" button.
405− <head>
405+ <head>
406− <script src="https://unpkg.com/@urbit/http-api"></script>
406+ <script src="https://unpkg.com/@urbit/http-api"></script>
407− <script src="/session.js"></script>
407+ <script src="/session.js"></script>
408− </head>
408+ </head>
409− <body>
409+ <body>
410− <button id="toggle" type="button" onClick="doSub()" >Subscribe</button>
410+ <button id="toggle" type="button" onClick="doSub()" >Subscribe</button>
411− <pre id="event"></pre>
411+ <pre id="event"></pre>
412− </body>
412+ </body>
413− <script>
413+ <script>
414 const api = new UrbitHttpApi.Urbit("");
414 const api = new UrbitHttpApi.Urbit("");
415 api.ship = window.ship;
415 api.ship = window.ship;
416 const toggle = document.getElementById("toggle");
416 const toggle = document.getElementById("toggle");
@@ -439,8 +439,8 @@ a chat. You can also unsubscribe by clicking the "Unsubscribe" button.
439 function subFail() {
439 function subFail() {
440 event.innerHTML = "Subscription failed!";
440 event.innerHTML = "Subscription failed!";
442− </script>
442+ </script>
443−</html>
443+</html>
446### Subscribe Once
446### Subscribe Once
@@ -478,16 +478,16 @@ first one it receives and close the subscription. Additionally, it sets a five
478second timeout, and prints an error message if it times out.
478second timeout, and prints an error message if it times out.
482− <head>
482+ <head>
483− <script src="https://unpkg.com/@urbit/http-api"></script>
483+ <script src="https://unpkg.com/@urbit/http-api"></script>
484− <script src="/session.js"></script>
484+ <script src="/session.js"></script>
485− </head>
485+ </head>
486− <body>
486+ <body>
487− <button type="button" onClick="doSub()" >Subscribe Once</button>
487+ <button type="button" onClick="doSub()" >Subscribe Once</button>
488− <pre id="event"></pre>
488+ <pre id="event"></pre>
489− </body>
489+ </body>
490− <script>
490+ <script>
491 const api = new UrbitHttpApi.Urbit("");
491 const api = new UrbitHttpApi.Urbit("");
492 api.ship = window.ship;
492 api.ship = window.ship;
493 const event = document.getElementById("event");
493 const event = document.getElementById("event");
@@ -502,8 +502,8 @@ second timeout, and prints an error message if it times out.
502 function noEvent(error) {
502 function noEvent(error) {
503 event.innerHTML = error;
503 event.innerHTML = error;
505− </script>
505+ </script>
506−</html>
506+</html>
509### Scries
509### Scries
@@ -526,16 +526,16 @@ agent's `/keys` endpoint for the list of graphs, and print the resulting JSON
530− <head>
530+ <head>
531− <script src="https://unpkg.com/@urbit/http-api"></script>
531+ <script src="https://unpkg.com/@urbit/http-api"></script>
532− <script src="/session.js"></script>
532+ <script src="/session.js"></script>
533− </head>
533+ </head>
534− <body>
534+ <body>
535− <button id="scry" type="button" onClick="doScry()" >Scry Graphs</button>
535+ <button id="scry" type="button" onClick="doScry()" >Scry Graphs</button>
536− <pre id="result"></pre>
536+ <pre id="result"></pre>
537− </body>
537+ </body>
538− <script>
538+ <script>
539 const api = new UrbitHttpApi.Urbit("");
539 const api = new UrbitHttpApi.Urbit("");
540 api.ship = window.ship;
540 api.ship = window.ship;
541 async function doScry() {
541 async function doScry() {
@@ -543,8 +543,8 @@ data.
543 document.getElementById("result")
543 document.getElementById("result")
544 .innerHTML = JSON.stringify(groups, null, 2);
544 .innerHTML = JSON.stringify(groups, null, 2);
546− </script>
546+ </script>
547−</html>
547+</html>
550### Thread
550### Thread
@@ -569,18 +569,18 @@ This example takes a hoon expression (such as `(add 1 1)`), evalutes it with the
569`graph-eval` thread in the `landscape` desk, and prints the result.
569`graph-eval` thread in the `landscape` desk, and prints the result.
573− <head>
573+ <head>
574− <script src="https://unpkg.com/@urbit/http-api"></script>
574+ <script src="https://unpkg.com/@urbit/http-api"></script>
575− <script src="/session.js"></script>
575+ <script src="/session.js"></script>
576− </head>
576+ </head>
577− <body>
577+ <body>
578− <input id="hoon" type="text" placeholder="Hoon to evaluate" />
578+ <input id="hoon" type="text" placeholder="Hoon to evaluate" />
579− <button id="submit" type="button" onClick="runThread()" >Submit</button>
579+ <button id="submit" type="button" onClick="runThread()" >Submit</button>
580− <pre id="expr"></pre>
580+ <pre id="expr"></pre>
581− <pre id="result"></pre>
581+ <pre id="result"></pre>
582− </body>
582+ </body>
583− <script>
583+ <script>
584 document.getElementById("hoon")
584 document.getElementById("hoon")
585 .addEventListener("keyup", function(event) {
585 .addEventListener("keyup", function(event) {
586 if (event.keyCode === 13) {
586 if (event.keyCode === 13) {
@@ -604,8 +604,8 @@ This example takes a hoon expression (such as `(add 1 1)`), evalutes it with the
604 expr.innerHTML = hoon.value;
604 expr.innerHTML = hoon.value;
605 hoon.value = "";
605 hoon.value = "";
607− </script>
607+ </script>
608−</html>
608+</html>
611### Delete Channel
611### Delete Channel