Update child-thread.md

This commit is contained in:
Sigilante 2023-01-05 11:52:34 -06:00 committed by GitHub
parent 0260d92f88
commit 76b2ac0fac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,19 +92,17 @@ We note that this is mostly the same as `await-thread:strandio`.
=, strand=strand:spider
=>
|%
++ url "https://www.whatsthelatestbasehash.com/"
++ url "https://sampledataapi.com/API/getcategory"
--
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
;< =cord bind:m (fetch-cord url)
=/ hash-as-cord `@t`(end [3 (sub (met 3 cord) 1)] cord)
=/ hash `@uv`(slav %uv hash-as-cord)
(pure:m !>(hash))
(pure:m !>(cord))
```
`child.hoon` simply grabs the latest base hash from https://www.whatsthelatestbasehash.com/ and returns it.
`child.hoon` simply grabs the JSON response from https://sampledataapi.com/ and returns it as a cord. (There is also a `++fetch-json:strandio` gate that could be employed here.)
`parent.hoon` is a bit more complicated so we'll look at it line-by-line