mirror of
https://github.com/urbit/shrub.git
synced 2024-11-29 06:45:42 +03:00
Updated Hoon style of chat, clock, timer
This commit is contained in:
parent
e69f51acb1
commit
dc103700e6
@ -102,8 +102,8 @@
|
||||
^- (quip move _this)
|
||||
~& (lent (prey:pubsub:userlib /primary bol))
|
||||
=* messages messages.str.sta
|
||||
=/ lisunitmov=(list (unit move))
|
||||
%+ turn ~(tap by messages)
|
||||
=/ lismov/(list move)
|
||||
%+ murn ~(tap by messages)
|
||||
|= [cir=circle:hall lis=(list envelope:hall)]
|
||||
^- (unit move)
|
||||
=/ envs/(unit (list envelope:hall)) (~(get by messages) cir)
|
||||
@ -123,15 +123,7 @@
|
||||
[%messages cir start end (swag [start offset] u.envs)]
|
||||
==
|
||||
:_ this
|
||||
%+ weld
|
||||
[ost.bol %diff %chat-config str.sta]~
|
||||
%+ turn %+ skim lisunitmov
|
||||
|= umov=(unit move)
|
||||
^- ?
|
||||
?~ umov
|
||||
%.n
|
||||
%.y
|
||||
need
|
||||
[[ost.bol %diff %chat-config str.sta] lismov]
|
||||
::
|
||||
:: +poke-chat: send us an action
|
||||
::
|
||||
@ -304,13 +296,14 @@
|
||||
?: add.rum
|
||||
(~(put in circles.str.sta) cir.rum)
|
||||
(~(del in circles.str.sta) cir.rum)
|
||||
=/ str %= str.sta
|
||||
=/ str
|
||||
%= str.sta
|
||||
circles cis
|
||||
peers
|
||||
?: add.rum
|
||||
(~(put by peers.str.sta) [our.bol cir.rum] ~)
|
||||
(~(del by peers.str.sta) [our.bol cir.rum])
|
||||
==
|
||||
==
|
||||
:- (send-chat-update [[%circles cis] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
@ -333,9 +326,10 @@
|
||||
?~ unes
|
||||
[~ this]
|
||||
=/ nes u.unes
|
||||
=/ str %= str.sta
|
||||
messages (~(put by messages) circle (snoc nes nev.sto))
|
||||
==
|
||||
=/ str
|
||||
%= str.sta
|
||||
messages (~(put by messages) circle (snoc nes nev.sto))
|
||||
==
|
||||
:- (send-chat-update [[%message circle nev.sto] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
@ -577,15 +571,15 @@
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
::
|
||||
%circle
|
||||
=/ shp/@p (slav %p &2:wir)
|
||||
=/ pat /circle/[&3:wir]/config/group
|
||||
?: =(&3:wir 'inbox')
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
?: (~(has in src.inbox.str.sta) [[shp &3:wir] ~])
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
[~ this]
|
||||
=/ shp/@p (slav %p &2:wir)
|
||||
=/ pat /circle/[&3:wir]/config/group
|
||||
?: =(&3:wir 'inbox')
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
?: (~(has in src.inbox.str.sta) [[shp &3:wir] ~])
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
[~ this]
|
||||
::
|
||||
%circles
|
||||
:_ this
|
||||
@ -603,15 +597,15 @@
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
::
|
||||
%circle
|
||||
=/ shp/@p (slav %p &2:wir)
|
||||
=/ pat /circle/[&3:wir]/config/group
|
||||
?: =(&3:wir 'inbox')
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
?: (~(has in src.inbox.str.sta) [[shp &3:wir] ~])
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
[~ this]
|
||||
=/ shp/@p (slav %p &2:wir)
|
||||
=/ pat /circle/[&3:wir]/config/group
|
||||
?: =(&3:wir 'inbox')
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
?: (~(has in src.inbox.str.sta) [[shp &3:wir] ~])
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
[~ this]
|
||||
::
|
||||
%circles
|
||||
:_ this
|
||||
|
@ -39,11 +39,12 @@
|
||||
++ prep
|
||||
|= old=(unit ~)
|
||||
^- (quip move _this)
|
||||
=/ lismov/(list move) %+ weld
|
||||
`(list move)`[ost.bol %connect / [~ /'~clock'] %clock]~
|
||||
`(list move)`[ost.bol %poke /clock [our.bol %launch] [%noun [%clock /tile '/~clock/js/tile.js']]]~
|
||||
:- lismov
|
||||
this
|
||||
=/ launchnoun [%noun [%clock /tile '/~clock/js/tile.js']]
|
||||
:_ this
|
||||
:~
|
||||
[ost.bol %connect / [~ /'~clock'] %clock]
|
||||
[ost.bol %poke /clock [our.bol %launch] launchnoun]
|
||||
==
|
||||
::
|
||||
++ peer-tile
|
||||
|= pax=path
|
||||
@ -61,10 +62,10 @@
|
||||
%- (require-authorization:app ost.bol move this)
|
||||
|= =inbound-request:http-server
|
||||
^- (quip move _this)
|
||||
=+ request-line=(parse-request-line url.request.inbound-request)
|
||||
=+ back-path=(flop site.request-line)
|
||||
=/ request-line (parse-request-line url.request.inbound-request)
|
||||
=/ back-path (flop site.request-line)
|
||||
=/ name=@t
|
||||
=+ back-path=(flop site.request-line)
|
||||
=/ back-path (flop site.request-line)
|
||||
?~ back-path
|
||||
''
|
||||
i.back-path
|
||||
|
@ -44,10 +44,12 @@
|
||||
++ prep
|
||||
|= old=(unit tim=@da)
|
||||
^- (quip move _this)
|
||||
=/ lismov/(list move) %+ weld
|
||||
`(list move)`[ost.bol %connect / [~ /'~timer'] %timer]~
|
||||
`(list move)`[ost.bol %poke /timer [our.bol %launch] [%noun [%timer /tile '/~timer/js/tile.js']]]~
|
||||
:- lismov
|
||||
=/ launchnoun [%noun [%timer /tile '/~timer/js/tile.js']]
|
||||
:-
|
||||
:~
|
||||
[ost.bol %connect / [~ /'~timer'] %timer]
|
||||
[ost.bol %poke /timer [our.bol %launch] launchnoun]
|
||||
==
|
||||
?~ old
|
||||
this
|
||||
%= this
|
||||
@ -76,25 +78,21 @@
|
||||
=/ str/@t +.jon
|
||||
?: =(str 'start')
|
||||
=/ data/@da (add now.bol ~s10)
|
||||
:- %+ weld
|
||||
`(list move)`(send-tile-diff [%s (scot %da data)])
|
||||
`(list move)`[ost.bol %wait /timer data]~
|
||||
this(tim data)
|
||||
:_ this(tim data)
|
||||
[[ost.bol %wait /timer data] (send-tile-diff [%s (scot %da data)])]
|
||||
?: =(str 'stop')
|
||||
:- %+ weld
|
||||
`(list move)`(send-tile-diff [%s ''])
|
||||
`(list move)`[ost.bol %rest /timer tim]~
|
||||
this(tim *@da)
|
||||
:_ this(tim *@da)
|
||||
[[ost.bol %rest /timer tim] (send-tile-diff [%s ''])]
|
||||
[~ this]
|
||||
::
|
||||
++ poke-handle-http-request
|
||||
%- (require-authorization:app ost.bol move this)
|
||||
|= =inbound-request:http-server
|
||||
^- (quip move _this)
|
||||
=+ request-line=(parse-request-line url.request.inbound-request)
|
||||
=+ back-path=(flop site.request-line)
|
||||
=/ request-line (parse-request-line url.request.inbound-request)
|
||||
=/ back-path (flop site.request-line)
|
||||
=/ name=@t
|
||||
=+ back-path=(flop site.request-line)
|
||||
=/ back-path (flop site.request-line)
|
||||
?~ back-path
|
||||
''
|
||||
i.back-path
|
||||
|
Loading…
Reference in New Issue
Block a user