diff --git a/project.clj b/project.clj index ba36770..0964836 100644 --- a/project.clj +++ b/project.clj @@ -33,7 +33,8 @@ :output-dir "target/classes/public/js/chat-demo" :optimizations :none :source-map true}}]} - :repl-options {:init-ns user + :repl-options {:timeout 120000 + :init-ns user :init (start) :welcome (do (println "Welcome to the core.async tutorial!") diff --git a/resources/templates/index.html b/resources/templates/index.html index dcb3cef..a66c904 100644 --- a/resources/templates/index.html +++ b/resources/templates/index.html @@ -31,7 +31,7 @@
- In order to complete this course, you will need this following: + In order to complete this course, you will need the following:
Nonetheless, this asynchronous variant would work just fine in ClojureScript. The only price we have to pay
is a small sampling of callback hell. But what if there was a way to maintain the readability of the
- synchronous function buy still enjoy the benefits of asynchronous operation? Well, let’s check out what
+ synchronous function but still enjoy the benefits of asynchronous operation? Well, let’s check out what
go can do for us:
go
The <! function takes a value from the channel. This function can only be used in the
- context context of a go. This will allow the loop to park until it has a value. It’s
- nice because it allow you to write code to appear as if the code blocks at that point without actually
+ context of a go. This will allow the loop to park until it has a value. It’s
+ nice because it allows you to write code to appear as if the code blocks at that point without actually
blocking.
We use a when-let because the channel will always produce a non-null value. If we get a
- null value, that indicates the channel was closed. This also means you can not put a null value into
+ null value, that indicates the channel was closed. This also means you cannot put a null value into
a channel. If there is a chance the channel will produce a false value, you can use
when-some instead, which was introduced in Clojure 1.6.
close! on the channel.
- This idempotent call will cause the channel to longer accept new values, but will allow readers to
+ This idempotent call will cause the channel to no longer accept new values, but will allow readers to
continue reading values until the channel is exhausted.
@@ -190,4 +190,4 @@ mult in practice- Now the only bit of functionality you will need to use in mult-channel properly is to ensure that when - the client disconnects you shut down things down properly: + Now the only bit of functionality you will need to use a mult-channel properly is to ensure that when + the client disconnects you shut things down properly:
(async/untap! subscribe-channel chat-events) (async/close! chat-events)@@ -127,4 +127,4 @@
async-workshop.chat-demo namespace. The client (ClojureScript) code will be under
- async-workshop.chat-demo.client, and the server (Clojure) code will be under
+ async-workshop.chat-demo namespace. The client (ClojureScript) code is under
+ async-workshop.chat-demo.client, and the server (Clojure) code is under
async-workshop.chat-demo.server.
(om/root chat-input-widget app-state
{:target (.getElementById js/document "chatInputWidget")})
- Note that in this example, the chat-input-widget var has ben referred.
+ Note that in this example, the chat-input-widget var has been referred.
- Now that there is a place to put the message, let’s modify send-message to the job. The
+ Now that there is a place to put the message, let’s modify send-message to do the job. The
code for this is fairly straightforward. Just dereference the cursor passed in to get access to the
channel:
- In this section, we’ve primary learned how to use multiple channels together using alts!.
+ In this section, we’ve primarily learned how to use multiple channels together using alts!.
In the next section, we’ll start seeing how we can use this technique together with several other
new ones to get multiple clients actually talking to each other.