mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-06 23:16:29 +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
|
:: watch an app at a particular path and forward all facts to a
|
||||||
:: particular thread
|
:: particular thread
|
||||||
::
|
::
|
||||||
|
/- sur=thread-watch-hook
|
||||||
/+ default-agent, dbug
|
/+ default-agent, dbug
|
||||||
::
|
::
|
||||||
|%
|
|%
|
||||||
@ -10,19 +11,14 @@
|
|||||||
+$ versioned-state
|
+$ versioned-state
|
||||||
$% state-0
|
$% 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
|
++ got-by-val
|
||||||
|= [a=(map time observer) b=observer]
|
|= [a=(map time observer:sur) b=observer:sur]
|
||||||
^- time
|
^- time
|
||||||
%- need
|
%- need
|
||||||
%+ roll ~(tap by a)
|
%+ roll ~(tap by a)
|
||||||
|= [[key=time val=observer] output=(unit time)]
|
|= [[key=time val=observer:sur] output=(unit time)]
|
||||||
?:(=(val b) `key output)
|
?:(=(val b) `key output)
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
@ -48,7 +44,7 @@
|
|||||||
?> (team:title our.bowl src.bowl)
|
?> (team:title our.bowl src.bowl)
|
||||||
?. ?=(%thread-watch-action mark)
|
?. ?=(%thread-watch-action mark)
|
||||||
(on-poke:def mark vase)
|
(on-poke:def mark vase)
|
||||||
=/ =action !<(action vase)
|
=/ =action:sur !<(action:sur vase)
|
||||||
=* observer observer.action
|
=* observer observer.action
|
||||||
=/ vals (silt ~(val by observers))
|
=/ vals (silt ~(val by observers))
|
||||||
?- -.action
|
?- -.action
|
||||||
@ -91,7 +87,7 @@
|
|||||||
[%thread-result @ ~] [~ this]
|
[%thread-result @ ~] [~ this]
|
||||||
[%observer @ ~]
|
[%observer @ ~]
|
||||||
=/ =time (slav %da i.t.wire)
|
=/ =time (slav %da i.t.wire)
|
||||||
=/ =observer (~(got by observers) time)
|
=/ =observer:sur (~(got by observers) time)
|
||||||
:_ this
|
:_ this
|
||||||
:_ ~
|
:_ ~
|
||||||
:* %pass
|
:* %pass
|
||||||
@ -109,7 +105,7 @@
|
|||||||
?~ p.sign [~ this]
|
?~ p.sign [~ this]
|
||||||
=/ =time (slav %da i.t.wire)
|
=/ =time (slav %da i.t.wire)
|
||||||
=/ tid (slav %uv i.t.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))
|
:_ this(observers (~(del by observers) time))
|
||||||
:~ :* %pass
|
:~ :* %pass
|
||||||
[%observer i.t.wire ~]
|
[%observer i.t.wire ~]
|
||||||
@ -142,7 +138,7 @@
|
|||||||
?. =(p.cage.sign %thread-fail)
|
?. =(p.cage.sign %thread-fail)
|
||||||
[~ this]
|
[~ this]
|
||||||
=/ =time (slav %da i.t.wire)
|
=/ =time (slav %da i.t.wire)
|
||||||
=/ =observer (~(got by observers) time)
|
=/ =observer:sur (~(got by observers) time)
|
||||||
:_ this(observers (~(del by observers) time))
|
:_ this(observers (~(del by observers) time))
|
||||||
:_ ~
|
:_ ~
|
||||||
:* %pass
|
:* %pass
|
||||||
@ -155,7 +151,7 @@
|
|||||||
::
|
::
|
||||||
[%observer @ ~]
|
[%observer @ ~]
|
||||||
=/ =time (slav %da i.t.wire)
|
=/ =time (slav %da i.t.wire)
|
||||||
=/ =observer (~(got by observers) time)
|
=/ =observer:sur (~(got by observers) time)
|
||||||
=/ tid (scot %uv (sham eny.bowl))
|
=/ tid (scot %uv (sham eny.bowl))
|
||||||
:_ this
|
:_ this
|
||||||
:~ :* %pass
|
:~ :* %pass
|
||||||
@ -164,7 +160,7 @@
|
|||||||
[our.bowl %spider]
|
[our.bowl %spider]
|
||||||
%poke
|
%poke
|
||||||
%spider-start
|
%spider-start
|
||||||
!>([~ `tid thread.observer q.cage.sign])
|
!>([~ `tid thread.observer (slop !>(cage.sign) !>(~))])
|
||||||
==
|
==
|
||||||
:* %pass
|
:* %pass
|
||||||
[%thread-result tid ~]
|
[%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