mirror of
https://github.com/urbit/shrub.git
synced 2024-12-15 04:22:48 +03:00
42 lines
914 B
Plaintext
42 lines
914 B
Plaintext
!:
|
|
::::::::: Appbug: a simple application.
|
|
::
|
|
|_ [hid=hide vat=[%0 p=@ud]]
|
|
++ poke
|
|
|= [ost=bone *]
|
|
:_ +>(p.vat +(p.vat))
|
|
:~ [ost %give %nice ~]
|
|
==
|
|
::
|
|
++ peek
|
|
|= [you=ship pax=path]
|
|
?^ pax
|
|
[%txt (crip "demo peeking {<p.vat>}")]
|
|
:- %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}))
|
|
; }
|
|
==
|
|
==
|
|
==
|
|
--
|
|
|
|
|