more doc fixed; changing references of you to we for inclusion.

This commit is contained in:
Danny Yoo 2011-08-29 16:49:33 -04:00
parent 84c7d457cb
commit 4eebe325fd
2 changed files with 20 additions and 12 deletions

View File

@ -106,8 +106,8 @@ However, it can also be packaged with @filepath{whalesong}.
-rw-rw-r-- 1 dyoo nogroup 692213 Jun 7 18:00 hello.xhtml -rw-rw-r-- 1 dyoo nogroup 692213 Jun 7 18:00 hello.xhtml
}| }|
Running @tt{whalesong build} on a Racket program will produce a self-contained Running @tt{whalesong build} on a Racket program will produce a self-contained
@filepath{.xhtml} file. If you open this file in your favorite web browser, @filepath{.xhtml} file. If we open this file in our favorite web browser,
you should see a triumphant message show on screen. we should see a triumphant message show on screen.
@ -260,7 +260,7 @@ given @racket[delay], it will use that instead.
Tells @racket[big-bang] to update the world during simulated movement. Tells @racket[big-bang] to update the world during simulated movement.
During the extent of a big-bang, a form widget will appear in the During the extent of a big-bang, a form widget will appear in the
@tt{document.body} to allow you to manually send location-changing @tt{document.body} to allow us to manually send location-changing
events. events.
The optional @tech{event} argument will contain numbers for The optional @tech{event} argument will contain numbers for
@ -446,7 +446,7 @@ For example,
(define-resource my-whale-image-resource "humpback.png") (define-resource my-whale-image-resource "humpback.png")
}| }|
} }
As a convenience, you can also write As a convenience, we can also write
@codeblock|{ @codeblock|{
#lang planet dyoo/whalesong #lang planet dyoo/whalesong
(require (planet dyoo/whalesong/resource)) (require (planet dyoo/whalesong/resource))
@ -482,17 +482,20 @@ For example,
@declare-exporting/this-package[web-world] @declare-exporting/this-package[web-world]
For a web-world program, output written by normal side effects such as For a web-world program, output is normally done by using
@racket[printf] or @racket[display] is still written to the current @racket[to-draw]. However, side effecting functions, such as
output port, whose default behavior appends to the end of @racket[printf] or @racket[display], are still available, and are
@tt{document.body}. You may want to either disable such printing or allowed to continue to append to @tt{document.body}.
direct the output to a particular element on the page. For such
purposes, use a combination of @racket[current-output-port] and
@racket[open-output-element].
For example, in We may want to disable such printing or redirect it to a particular
element on the page. For such purposes, use a combination of
@racket[current-output-port] and @racket[open-output-element] to
redirect the output of these side effect functions to somewhere else.
For example:
@codeblock|{ @codeblock|{
... ...
;; Redirect standard output to a div called "stdout-div".
(current-output-port (open-output-element "stdout-div")) (current-output-port (open-output-element "stdout-div"))
... ...
(big-bang ... (big-bang ...
@ -502,12 +505,14 @@ For example, in
...) ...)
}| }|
All subsequent I/O side effects after the call to All subsequent I/O side effects after the call to
@racket[current-output-port] will be written out to the @racket[current-output-port] will be written out to the
@tt{stdout-div}, which can be easily styled with @tt{display: none} to @tt{stdout-div}, which can be easily styled with @tt{display: none} to
hide it from normal browser display. hide it from normal browser display.
@defproc[(open-output-element [id string]) output-port]{ @defproc[(open-output-element [id string]) output-port]{
Opens an output port that will be directed to write to the DOM element Opens an output port that will be directed to write to the DOM element
whose id is @racket[id]. Note: writing to this port shouldn't fail, whose id is @racket[id]. Note: writing to this port shouldn't fail,

View File

@ -3,6 +3,9 @@
<body> <body>
<p>The current counter is: <span id="counter">fill-me-in</span></p> <p>The current counter is: <span id="counter">fill-me-in</span></p>
<p>There is content from the <tt>printf</tt> statements going into
the hidden div below:</p>
<!-- This div is hidden. --> <!-- This div is hidden. -->
<div id="stdout" <div id="stdout"
style="border: 1px solid black; display: none " /> style="border: 1px solid black; display: none " />