on master help sign in
gall-guide: lifecycle - add ::'s to break up code
5dc7ae0Tinnus Napbus
content/docs/userspace/gall-guide/4-lifecycle.md+8
@@ -216,12 +216,15 @@ Here's a new agent to demonstrate the concepts we've discussed here:
216|_ =bowl:gall
216|_ =bowl:gall
217+* this .
217+* this .
218 def ~(. (default-agent this %.n) bowl)
218 def ~(. (default-agent this %.n) bowl)
219+::
219++ on-init
220++ on-init
220 ^- (quip card _this)
221 ^- (quip card _this)
221 `this(val 42)
222 `this(val 42)
223+::
222++ on-save
224++ on-save
223 ^- vase
225 ^- vase
224 !>(state)
226 !>(state)
227+::
225++ on-load
228++ on-load
226 |= old-state=vase
229 |= old-state=vase
227 ^- (quip card _this)
230 ^- (quip card _this)
@@ -229,6 +232,7 @@ Here's a new agent to demonstrate the concepts we've discussed here:
229 ?- -.old
232 ?- -.old
230 %0 `this(state old)
233 %0 `this(state old)
231 ==
234 ==
235+::
232++ on-poke on-poke:def
236++ on-poke on-poke:def
233++ on-watch on-watch:def
237++ on-watch on-watch:def
234++ on-leave on-leave:def
238++ on-leave on-leave:def
@@ -354,12 +358,15 @@ again save in `/app/lifecycle.hoon` and `|commit %base`:
354|_ =bowl:gall
358|_ =bowl:gall
355+* this .
359+* this .
356 def ~(. (default-agent this %.n) bowl)
360 def ~(. (default-agent this %.n) bowl)
361+::
357++ on-init
362++ on-init
358 ^- (quip card _this)
363 ^- (quip card _this)
359 `this(val [27 32])
364 `this(val [27 32])
365+::
360++ on-save
366++ on-save
361 ^- vase
367 ^- vase
362 !>(state)
368 !>(state)
369+::
363++ on-load
370++ on-load
364 |= old-state=vase
371 |= old-state=vase
365 ^- (quip card _this)
372 ^- (quip card _this)
@@ -368,6 +375,7 @@ again save in `/app/lifecycle.hoon` and `|commit %base`:
368 %1 `this(state old)
375 %1 `this(state old)
369 %0 `this(state 1+[val.old val.old])
376 %0 `this(state 1+[val.old val.old])
370 ==
377 ==
378+::
371++ on-poke on-poke:def
379++ on-poke on-poke:def
372++ on-watch on-watch:def
380++ on-watch on-watch:def
373++ on-leave on-leave:def
381++ on-leave on-leave:def