mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-05 22:03:50 +03:00
add app poking to stdio
This commit is contained in:
parent
2fd87c815b
commit
9d1e8601e3
@ -13,7 +13,11 @@
|
||||
$: top-comments=(list tape)
|
||||
==
|
||||
+$ command cord
|
||||
++ tapp (^tapp state command)
|
||||
+$ poke-data
|
||||
$% [%noun cord]
|
||||
==
|
||||
++ tapp (^tapp state command poke-data)
|
||||
++ stdio (^stdio poke-data)
|
||||
--
|
||||
=>
|
||||
|%
|
||||
|
30
app/sitter.hoon
Normal file
30
app/sitter.hoon
Normal file
@ -0,0 +1,30 @@
|
||||
/+ tapp, stdio
|
||||
=>
|
||||
|%
|
||||
+$ subscription-state
|
||||
$: her=ship
|
||||
app=term
|
||||
==
|
||||
+$ state
|
||||
$: subscription=(unit subscription-state)
|
||||
==
|
||||
+$ command cord
|
||||
+$ poke-data
|
||||
$% [%noun cord]
|
||||
==
|
||||
++ tapp (^tapp state command poke-data)
|
||||
++ stdio (^stdio poke-data)
|
||||
--
|
||||
=, trad=trad:tapp
|
||||
=, tapp-trad=tapp-trad:tapp
|
||||
=, stdio
|
||||
%- create-tapp:tapp
|
||||
^- tapp-core:tapp
|
||||
|_ [=bowl:gall state]
|
||||
++ handle-command
|
||||
|= =command
|
||||
=/ m tapp-trad
|
||||
^- form:m
|
||||
;< ~ bind:m (poke-app [our.bowl %baby] %noun 'print')
|
||||
(pure:m subscription)
|
||||
--
|
@ -12,6 +12,8 @@
|
||||
::
|
||||
/- tapp-sur=tapp
|
||||
/+ trad
|
||||
|* poke-data=mold
|
||||
=/ tapp-sur (tapp-sur poke-data)
|
||||
=, card=card:tapp-sur
|
||||
=, sign=sign:tapp-sur
|
||||
=, contract=contract:tapp-sur
|
||||
@ -36,6 +38,15 @@
|
||||
|= trad-input
|
||||
[~ ~ (silt [add contract]~) %done ~]
|
||||
::
|
||||
:: Send effect
|
||||
::
|
||||
++ send-effect
|
||||
|= =card
|
||||
=/ m (trad ,~)
|
||||
^- form:m
|
||||
|= trad-input
|
||||
[~ [card]~ ~ %done ~]
|
||||
::
|
||||
:: ----
|
||||
::
|
||||
:: HTTP requests
|
||||
@ -181,4 +192,14 @@
|
||||
?. ?=(%cont -.next.c-res)
|
||||
c-res
|
||||
c-res(self.next ..loop(computation self.next.c-res))
|
||||
::
|
||||
:: ----
|
||||
::
|
||||
:: Apps
|
||||
::
|
||||
++ poke-app
|
||||
|= [[her=ship app=term] =poke-data]
|
||||
=/ m (trad ,~)
|
||||
^- form:m
|
||||
(send-effect %poke / [her app] poke-data)
|
||||
--
|
||||
|
@ -1,11 +1,11 @@
|
||||
/- tapp
|
||||
/- tapp-sur=tapp
|
||||
/+ trad
|
||||
=, card=card:tapp
|
||||
=, sign=sign:tapp
|
||||
=, contract=contract:tapp
|
||||
=, trad-lib=trad
|
||||
|* [state-type=mold command-type=mold]
|
||||
|* [state-type=mold command-type=mold poke-data=mold]
|
||||
|%
|
||||
++ tapp-sur (^tapp-sur poke-data)
|
||||
++ card card:tapp-sur
|
||||
++ sign sign:tapp-sur
|
||||
++ contract contract:tapp-sur
|
||||
::
|
||||
:: The form of a tapp
|
||||
::
|
||||
@ -17,7 +17,7 @@
|
||||
*form:tapp-trad
|
||||
--
|
||||
::
|
||||
++ trad-lib (^trad-lib sign card contract)
|
||||
++ trad-lib (^trad sign card contract)
|
||||
++ trad trad:trad-lib
|
||||
::
|
||||
+$ move (pair bone card)
|
||||
@ -34,7 +34,7 @@
|
||||
++ prep
|
||||
|= old-state=*
|
||||
^- (quip move _this-tapp)
|
||||
~& %tapp-loaded
|
||||
~& [%tapp-loaded dap.bowl]
|
||||
=/ old ((soft tapp-state) old-state)
|
||||
?~ old
|
||||
`this-tapp
|
||||
|
@ -1,3 +1,4 @@
|
||||
|* poke-data=mold
|
||||
|%
|
||||
::
|
||||
:: Possible async calls
|
||||
@ -7,6 +8,7 @@
|
||||
[%them wire ~]
|
||||
[%wait wire @da]
|
||||
[%rest wire @da]
|
||||
[%poke wire dock poke-data]
|
||||
==
|
||||
::
|
||||
:: Possible async responses
|
||||
|
Loading…
Reference in New Issue
Block a user