mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 20:02:51 +03:00
59 lines
1.3 KiB
Plaintext
59 lines
1.3 KiB
Plaintext
/- demo-args
|
|
!:
|
|
::::::::: Appbug: a simple application.
|
|
::
|
|
|_ [hid=hide vat=[%0 p=@ud]]
|
|
++ poke
|
|
|= [ost=bone you=ship *]
|
|
:_ +>(p.vat +(p.vat))
|
|
~& %poke
|
|
:~ [ost %give %nice ~]
|
|
==
|
|
::
|
|
++ poke-demo-args
|
|
|= [ost=bone you=ship arg=demo-args]
|
|
~& [%poke-demo-args arg]
|
|
:_ +>(p.vat +(p.vat))
|
|
:* [ost %give %nice ~]
|
|
%+ turn (~(tap by sup.hid))
|
|
|= [ost=bone *]
|
|
:- ost
|
|
:^ %give %rush %wut
|
|
[p.arg %says q.arg]
|
|
==
|
|
::
|
|
++ peer
|
|
|= [ost=bone you=ship pax=path]
|
|
?^ pax
|
|
:_ +>.$ :_ ~
|
|
[ost %give %rust %txt (crip "demo peeking {<p.vat>}")]
|
|
:_ +>.$ :_ ~
|
|
:+ ost %give
|
|
:- %meta
|
|
!>
|
|
:+ %rust %hymn
|
|
^- manx
|
|
;html
|
|
;head
|
|
;title: Demo!
|
|
;script: urb.appl = '{(trip app.hid)}'
|
|
==
|
|
;body
|
|
;p: State is {<p.vat>}.
|
|
;button(onclick "bump()"): (Bump.)
|
|
;script
|
|
; var mess = 0
|
|
;
|
|
; function bump() {
|
|
; xhr = new XMLHttpRequest()
|
|
; xhr.onload = function() { mess++}
|
|
; xhr.open("PUT", "/tim/" + [urb.user, urb.port, mess].join("/"))
|
|
; xhr.setRequestHeader("content-type", "text/json")
|
|
; xyro = {ship: urb.ship, appl: urb.appl, data: {}}
|
|
; xhr.send(JSON.stringify({oryx: urb.oryx, xyro: xyro}))
|
|
; }
|
|
==
|
|
==
|
|
==
|
|
--
|