mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +03:00
73 lines
1.4 KiB
Plaintext
73 lines
1.4 KiB
Plaintext
/+ store=graph-store, default-agent, dbug
|
|
|%
|
|
+$ card card:agent:gall
|
|
+$ versioned-state
|
|
$% state-0
|
|
==
|
|
+$ state-0 [%0 network:store]
|
|
--
|
|
::
|
|
=| state-0
|
|
=* state -
|
|
::
|
|
%- agent:dbug
|
|
^- agent:gall
|
|
|_ =bowl:gall
|
|
+* this .
|
|
def ~(. (default-agent this %|) bowl)
|
|
::
|
|
++ on-init [~ this]
|
|
++ on-save !>(state)
|
|
++ on-load
|
|
|= old=vase
|
|
^- (quip card _this)
|
|
[~ this(state !<(state-0 old))]
|
|
::
|
|
++ on-poke
|
|
|= [=mark =vase]
|
|
^- (quip card _this)
|
|
|^
|
|
?> (team:title our.bowl src.bowl)
|
|
=^ cards state
|
|
?+ mark (on-poke:def mark vase)
|
|
%graph-action (graph-action !<(action:store vase))
|
|
==
|
|
[cards this]
|
|
::
|
|
++ graph-action
|
|
|= =action:store
|
|
^- (quip card _state)
|
|
[~ state]
|
|
--
|
|
::
|
|
++ on-watch
|
|
|= =path
|
|
^- (quip card _this)
|
|
|^
|
|
?> (team:title our.bowl src.bowl)
|
|
=/ cards=(list card)
|
|
?+ path (on-watch:def path)
|
|
[%all ~] (give [%initial graphs tags tag-queries])
|
|
[%keys ~] (give [%keys ~(key by graphs)])
|
|
==
|
|
[cards this]
|
|
::
|
|
++ give
|
|
|= =update:store
|
|
^- (list card)
|
|
[%give %fact ~ [%graph-update !>(update)]]~
|
|
--
|
|
::
|
|
++ on-peek
|
|
|= =path
|
|
^- (unit (unit cage))
|
|
?+ path (on-peek:def path)
|
|
[%x %keys ~] ``noun+!>(~(key by graphs))
|
|
==
|
|
::
|
|
++ on-arvo on-arvo:def
|
|
++ on-agent on-agent:def
|
|
++ on-leave on-leave:def
|
|
++ on-fail on-fail:def
|
|
--
|