diff options
Diffstat (limited to 'demo')
-rw-r--r-- | demo/increment.ur | 10 | ||||
-rw-r--r-- | demo/increment.urp | 4 | ||||
-rw-r--r-- | demo/increment.urs | 1 | ||||
-rw-r--r-- | demo/prose | 4 |
4 files changed, 19 insertions, 0 deletions
diff --git a/demo/increment.ur b/demo/increment.ur new file mode 100644 index 00000000..a74e80df --- /dev/null +++ b/demo/increment.ur @@ -0,0 +1,10 @@ +sequence seq + +fun increment () = nextval seq + +fun main () = + src <- source 0; + return <xml><body> + <dyn signal={n <- signal src; return <xml>{[n]}</xml>}/> + <button value="Update" onclick={n <- increment (); set src n}/> + </body></xml> diff --git a/demo/increment.urp b/demo/increment.urp new file mode 100644 index 00000000..777a6edd --- /dev/null +++ b/demo/increment.urp @@ -0,0 +1,4 @@ +database dbname=test +sql increment.sql + +increment diff --git a/demo/increment.urs b/demo/increment.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/demo/increment.urs @@ -0,0 +1 @@ +val main : unit -> transaction page @@ -205,3 +205,7 @@ listEdit.urp <p>The central data structure is the <tt>rlist</tt>, a list whose individual elements are sources, enabling fine-grained mutation. Every rlist is either nil or is a cons cell made up of a source for a string data element, another source to serve as a scratchpad for GUI-based edits to the data element, and a final source that stores the remainder of the list.</p> <p>The main program provides operations to append to a list and to edit the data stored at any cell of the list. Append is implemented by maintaining a source <tt>head</tt>, which points to the first list element; and a source <tt>tailP</tt>, which points to a <tt>source rlist</tt> where we should place the next appended node.</p> + +increment.urp + +<p>Here's an example where client-side code needs to run more code on the server. We maintain a (server-side) SQL sequence. When the user clicks a button, an AJAX request increments the remote sequence and gets the new value.</p> |