mirror of
https://github.com/rabbibotton/clog.git
synced 2026-04-27 07:30:54 -07:00
Prevent GC using (run body)
This commit is contained in:
parent
68882c1692
commit
d11148bcc9
12 changed files with 48 additions and 9 deletions
|
|
@ -23,7 +23,12 @@
|
|||
(set-on-click hello-element ; Now we set a function to handle clicks
|
||||
(lambda (obj) ; In this case we use an anonymous function
|
||||
(declare (ignore obj))
|
||||
(setf (color hello-element) "green")))))
|
||||
(setf (color hello-element) "green")))
|
||||
|
||||
(run body))) ; Keep our thread alive until connection closes
|
||||
; and prevent garbage collection of our CLOG-Objects
|
||||
; until no longer needed.
|
||||
|
||||
;; To see all the events one can set and the many properties and styles that
|
||||
;; exist, take a look through the CLOG manual or the file clog-element.lisp
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@
|
|||
(dotimes (n x)
|
||||
(create-child body
|
||||
(format nil "<p>Clicked ~A times.</p>" x))
|
||||
(scroll-to (window body) 0 (height body))))))))
|
||||
(scroll-to (window body) 0 (height body))))))
|
||||
(run body)))
|
||||
|
||||
(defun start-tutorial ()
|
||||
"Start turtorial."
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
(dotimes (n x)
|
||||
(create-child body
|
||||
(format nil "<p>Clicked ~A times.</p>" x))
|
||||
(sleep x)))))))
|
||||
(sleep x)))))
|
||||
(run body)))
|
||||
|
||||
;; Running this version of the last tutorial and clicking quickly on the (click me!)
|
||||
;; will demonstrate an important aspect of CLOG, events can happen in _parallel_.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@
|
|||
#'my-on-click)
|
||||
|
||||
(set-on-click (create-child body "<h3>Click me too!</h3>")
|
||||
#'my-on-click))
|
||||
#'my-on-click)
|
||||
|
||||
(run body))
|
||||
|
||||
(defun start-tutorial ()
|
||||
"Start turtorial."
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@
|
|||
#'my-on-click)
|
||||
|
||||
(setf (connection-data-item body "changer")
|
||||
(create-child body "<h1>I change</h1>")))
|
||||
(create-child body "<h1>I change</h1>"))
|
||||
|
||||
(run body))
|
||||
|
||||
(defun start-tutorial ()
|
||||
"Start turtorial."
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@
|
|||
(setf (title (html-document body)) "Tutorial 6")
|
||||
|
||||
(set-on-click (create-child body "<h1>(click me to start!)</h1>")
|
||||
#'my-on-click))
|
||||
#'my-on-click)
|
||||
(run body))
|
||||
|
||||
(defun start-tutorial ()
|
||||
"Start turtorial."
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@
|
|||
(sleep .02))))
|
||||
(error (c)
|
||||
(format t "Lost connection.~%~%~A" c))))
|
||||
;; There is no reason to run (run body) here as we check for (validp body)
|
||||
;; and once the connection dies so does the on-new-window thread.
|
||||
|
||||
(defun start-tutorial ()
|
||||
"Start turtorial."
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@
|
|||
|
||||
(setf (positioning div3) :absolute)
|
||||
(set-on-mouse-down div3 'on-mouse-down)
|
||||
(create-span div3 "Hello world!")))
|
||||
(create-span div3 "Hello world!")
|
||||
|
||||
(run body)))
|
||||
|
||||
(defun start-tutorial ()
|
||||
"Start turtorial."
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@
|
|||
(select-tab p2)))
|
||||
(set-on-click t3 (lambda (obj)
|
||||
(setf last-tab obj)
|
||||
(select-tab p3))))))
|
||||
(select-tab p3))))
|
||||
(run body)))
|
||||
|
||||
(defun start-tutorial ()
|
||||
"Start turtorial."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue