From bbe3c6d56c64e5097b52abac0f572686a7fea019 Mon Sep 17 00:00:00 2001
From: David Botton Next, we need to use the Next, we tell clog to start a clog-repl: At this point our At this point We can new enter the clog-user package and hack a way. Something more than an empty lambda function is needed to do more. The
tutorials are a good place to start with make We need to give ourselves easier access to Since we already initialized Now go ahead and resresh our browser and you should see the famous first words
-of every app. This of though is still not very REPL like, Reset your browser again (or navigate to http://127.0.0.1:8080 and let's have
-some fun. (From here on, we will leave out the promps and responses in our quotes of
+ (From here on, we will leave out the prompts and responses in our quotes of
code.)INITIALIZE function to tell CLOG to start up the web
-server, what to do when someone connects and where the static HTML files
-are located.CL-USER> (clog:initialize (lambda (body)()) :static-root #P"~/common-lisp/clog/static-files/")
+
-CL-USER> (clog:clog-repl)
Hunchentoot server is started.
Listening on 0.0.0.0:8080.
HTTP listening on : 0.0.0.0:8080
-HTML Root : /Users/dbotton/common-lisp/clog/static-files/
-Boot file for path / : /boot.html
+HTML Root : ~/common-lisp/clog/static-files/
+Boot file for path / : /debug.html
+
+Use clog-user:*body* to access the clog-repl window.
NILCLOG app does very little. To see our CLOG app so far go to
-http://127.0.0.1:8008 or in most common-list configurations you can use:CLOG should open a browser window to
+ http://127.0.0.1:8008/repl
+CL-USER> (clog:open-browser)CL-USER> (in-package clog-user)
+#<"CLOG-USER" package>
+CLOG-USER> (setf (background-color *body*) :red)CLOG apps in code, so
here we are going to demonstrate the concepts using some REPL tricks
to help developing CLOG apps in general.CLOG and or an app we are
-working one. Let's create a package that uses CLOG and of course
-common lisp "cl" we will call it "clog-user".
-
CL-USER> (defpackage #:clog-user
- (:use #:cl #:clog))
-(in-package :clog-user)
-#<"CLOG-USER" package>
-CLOG-USER> CLOG let's use SET-ON-NEW-WINDOW to change our
on-new-window handler (handler is just a made up name for a function that
will handle an event).
-CLOG-USER> (set-on-new-window (lambda (body) (create-div body :content "Hello World!")))CLOG is a 'live' connection to a
-browser. So lets redo our on-new-window handler to give us access to the
-browser in the REPL.
-
-CLOG-USER> (defparameter *body* nil)
-*BODY*
-CLOG-USER> (set-on-new-window (lambda (body) (setf *body* body)))
@@ -357,13 +337,53 @@ function. If (create-div *body* :content "Hello World")BOOT-FILE is nil path is removed.
Turn on browser console debugging for OBJ's connection.
[function] OPEN-BROWSER &KEY (URL "http://127.0.0.1:8080")
+ +Open a web browser to URL.
CLOG utilities
CLOG-Group - Utility Class for CLOG-Obj storage
+ + + +[function] CREATE-GROUP
+ +Return a new CLOG-GROUP object for storing CLOG-OBJs. They are indexed by
+their HTML-ID.
[generic-function] ADD CLOG-GROUP CLOG-OBJ &KEY NAME
+ +Add CLOG-OBJ to a CLOG-GROUP indexed by the html-id of
+CLOG-OBJ unless :NAME is set and is used instead.
CLOG JS utilities
BOOT-FILE is nil path is removed.
Return "on" if VALUE t or return "off"
[function] OPEN-BROWSER &KEY (URL "http://127.0.0.1:8080")
- -Open a web browser to URL.
BOOT-FILE is nil path is removed.
Escape STR for sending to browser script.
CLOG Color utilities
Load demo NUM - use (clog-user:start-demo)
[function] CLOG-REPL
+ +Set a path /repl that opens a blank page and sets the global +clog-user:body to last window openned to /repl.
Functions for Compilation and Documentation