mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 13:54:20 +03:00
thread-watch-hook: moved to marks and slopped vases
This commit is contained in:
parent
ce43ea0765
commit
353d328340
@ -3,6 +3,7 @@
|
||||
:: watch an app at a particular path and forward all facts to a
|
||||
:: particular thread
|
||||
::
|
||||
/- sur=thread-watch-hook
|
||||
/+ default-agent, dbug
|
||||
::
|
||||
|%
|
||||
@ -10,19 +11,14 @@
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
==
|
||||
+$ observer [app=term =path input=mark thread=term]
|
||||
+$ state-0 [%0 observers=(map time observer)]
|
||||
+$ action
|
||||
$% [%watch =observer]
|
||||
[%ignore =observer]
|
||||
==
|
||||
::
|
||||
+$ state-0 [%0 observers=(map time observer:sur)]
|
||||
++ got-by-val
|
||||
|= [a=(map time observer) b=observer]
|
||||
|= [a=(map time observer:sur) b=observer:sur]
|
||||
^- time
|
||||
%- need
|
||||
%+ roll ~(tap by a)
|
||||
|= [[key=time val=observer] output=(unit time)]
|
||||
|= [[key=time val=observer:sur] output=(unit time)]
|
||||
?:(=(val b) `key output)
|
||||
--
|
||||
::
|
||||
@ -48,7 +44,7 @@
|
||||
?> (team:title our.bowl src.bowl)
|
||||
?. ?=(%thread-watch-action mark)
|
||||
(on-poke:def mark vase)
|
||||
=/ =action !<(action vase)
|
||||
=/ =action:sur !<(action:sur vase)
|
||||
=* observer observer.action
|
||||
=/ vals (silt ~(val by observers))
|
||||
?- -.action
|
||||
@ -91,7 +87,7 @@
|
||||
[%thread-result @ ~] [~ this]
|
||||
[%observer @ ~]
|
||||
=/ =time (slav %da i.t.wire)
|
||||
=/ =observer (~(got by observers) time)
|
||||
=/ =observer:sur (~(got by observers) time)
|
||||
:_ this
|
||||
:_ ~
|
||||
:* %pass
|
||||
@ -109,7 +105,7 @@
|
||||
?~ p.sign [~ this]
|
||||
=/ =time (slav %da i.t.wire)
|
||||
=/ tid (slav %uv i.t.t.wire)
|
||||
=/ =observer (~(got by observers) time)
|
||||
=/ =observer:sur (~(got by observers) time)
|
||||
:_ this(observers (~(del by observers) time))
|
||||
:~ :* %pass
|
||||
[%observer i.t.wire ~]
|
||||
@ -142,7 +138,7 @@
|
||||
?. =(p.cage.sign %thread-fail)
|
||||
[~ this]
|
||||
=/ =time (slav %da i.t.wire)
|
||||
=/ =observer (~(got by observers) time)
|
||||
=/ =observer:sur (~(got by observers) time)
|
||||
:_ this(observers (~(del by observers) time))
|
||||
:_ ~
|
||||
:* %pass
|
||||
@ -155,7 +151,7 @@
|
||||
::
|
||||
[%observer @ ~]
|
||||
=/ =time (slav %da i.t.wire)
|
||||
=/ =observer (~(got by observers) time)
|
||||
=/ =observer:sur (~(got by observers) time)
|
||||
=/ tid (scot %uv (sham eny.bowl))
|
||||
:_ this
|
||||
:~ :* %pass
|
||||
@ -164,7 +160,7 @@
|
||||
[our.bowl %spider]
|
||||
%poke
|
||||
%spider-start
|
||||
!>([~ `tid thread.observer q.cage.sign])
|
||||
!>([~ `tid thread.observer (slop !>(cage.sign) !>(~))])
|
||||
==
|
||||
:* %pass
|
||||
[%thread-result tid ~]
|
||||
|
13
pkg/arvo/mar/thread-watch/action.hoon
Normal file
13
pkg/arvo/mar/thread-watch/action.hoon
Normal file
@ -0,0 +1,13 @@
|
||||
/- sur=thread-watch-hook
|
||||
|_ =action:sur
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun action
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun action:sur
|
||||
--
|
||||
--
|
7
pkg/arvo/sur/thread-watch-hook.hoon
Normal file
7
pkg/arvo/sur/thread-watch-hook.hoon
Normal file
@ -0,0 +1,7 @@
|
||||
|%
|
||||
+$ observer [app=term =path thread=term]
|
||||
+$ action
|
||||
$% [%watch =observer]
|
||||
[%ignore =observer]
|
||||
==
|
||||
--
|
Loading…
Reference in New Issue
Block a user