mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
66 lines
1.2 KiB
Plaintext
66 lines
1.2 KiB
Plaintext
/- store=demo
|
|
/+ default-agent, verb, dbug, push-hook, resource, agentio
|
|
|%
|
|
+$ card card:agent:gall
|
|
::
|
|
++ config
|
|
^- config:push-hook
|
|
:* %demo-store
|
|
/updates
|
|
update:store
|
|
%demo-update
|
|
%demo-pull-hook
|
|
::
|
|
0
|
|
0
|
|
==
|
|
::
|
|
+$ agent (push-hook:push-hook config)
|
|
--
|
|
::
|
|
::
|
|
%- agent:dbug
|
|
%+ verb |
|
|
^- agent:gall
|
|
%- (agent:push-hook config)
|
|
^- agent
|
|
|_ =bowl:gall
|
|
+* this .
|
|
def ~(. (default-agent this %|) bowl)
|
|
grp ~(. grpl bowl)
|
|
io ~(. agentio bowl)
|
|
::
|
|
++ on-init on-init:def
|
|
++ on-save !>(~)
|
|
++ on-load on-load:def
|
|
++ on-poke on-poke:def
|
|
++ on-agent on-agent:def
|
|
++ on-watch on-watch:def
|
|
++ on-leave on-leave:def
|
|
++ on-peek on-peek:def
|
|
++ on-arvo on-arvo:def
|
|
++ on-fail on-fail:def
|
|
::
|
|
++ transform-proxy-update
|
|
|= vas=vase
|
|
^- (unit vase)
|
|
`vas
|
|
::
|
|
++ resource-for-update
|
|
|= =vase
|
|
=+ !<(=update:store vase)
|
|
~[p.update]
|
|
::
|
|
++ take-update
|
|
|= =vase
|
|
^- [(list card) agent]
|
|
`this
|
|
::
|
|
++ initial-watch
|
|
|= [=path rid=resource]
|
|
^- vase
|
|
=+ .^(=update:store %gx (scry:io %demo-store (snoc `^path`log+(en-path:resource rid) %noun)))
|
|
!>(update)
|
|
::
|
|
--
|