HTML and CSS Reference
In-Depth Information
Add an empty dl element to index.html and assign it id="messages" .
Then update the chat _ client.js file as seen in Listing 15.63.
Listing 15.63 Updated bootstrap script
(function () {
if (typeof tddjs == "undefined" ||
typeof document == "undefined") {
var c = tddjs.namespace("chat");
if (!document.getElementById || !tddjs ||
!c.userFormController || !c.messageListController) {
alert("Browser is not supported");
var model = Object.create(tddjs.ajax.cometClient);
model.url = "/comet";
/* ... */
userController.observe("user", function (user) {
var messages = document.getElementById("messages");
var messagesController =
Start the server again, and repeat the exercise from Listing 14.27 in Chapter 14,
Server-Side JavaScript with Node.js. After posting a message using curl , it should
immediately appear in your browser. If you post enough messages, you'll notice that
the document eventually gains a scroll and that messages appear below the fold.
That clearly isn't very helpful, so we'll make a note of it and get right on it as we
add some finishing touches toward the end of the chapter.
Search WWH ::

Custom Search