Update web cell API

svn: r6452
This commit is contained in:
Jay McCarthy 2007-06-01 18:05:50 +00:00
parent 9a7f0d4bed
commit d07341dc9d
2 changed files with 8 additions and 19 deletions

View File

@ -7,17 +7,17 @@
(define (start _) (define (start _)
(main-page)) (main-page))
(define the-counter (make-web-cell:local 0)) (define the-counter (make-web-cell 0))
(define the-header (make-web-cell:local (box "Main page"))) (define the-header (make-web-cell (box "Main page")))
(define (counter) (define (counter)
(send/suspend/dispatch (send/suspend/dispatch
(lambda (embed/url) (lambda (embed/url)
`(html (h2 ,(number->string (web-cell:local-ref the-counter))) `(html (h2 ,(number->string (web-cell-ref the-counter)))
(a ([href ,(embed/url (a ([href ,(embed/url
(lambda _ (lambda _
(web-cell:local-mask the-counter (web-cell-shadow the-counter
(add1 (web-cell:local-ref the-counter))) (add1 (web-cell-ref the-counter)))
(counter)))]) (counter)))])
"Increment") "Increment")
(br) (br)
@ -29,11 +29,11 @@
(define (main-page) (define (main-page)
(send/suspend/dispatch (send/suspend/dispatch
(lambda (embed/url) (lambda (embed/url)
`(html (h2 ,(unbox (web-cell:local-ref the-header))) `(html (h2 ,(unbox (web-cell-ref the-header)))
(form ([method "POST"] (form ([method "POST"]
[action ,(embed/url [action ,(embed/url
(lambda (req) (lambda (req)
(set-box! (web-cell:local-ref the-header) (set-box! (web-cell-ref the-header)
(extract-binding/single 'header (request-bindings req))) (extract-binding/single 'header (request-bindings req)))
(main-page)))]) (main-page)))])
(input ([type "text"] [name "header"])) (input ([type "text"] [name "header"]))

View File

@ -1,11 +0,0 @@
(module jas01-fix-param mzscheme
(require (lib "servlet.ss" "web-server"))
(provide get-time)
(define load-time
(make-web-cell:local #f))
(define (get-time)
(web-cell:local-ref load-time))
(web-cell:local-set! load-time (current-seconds)))