Permalink
Browse files

Applying new conding conventions of MLstate.

  • Loading branch information...
akoprow committed Feb 22, 2012
1 parent 906d583 commit 8798773a258a6b4ef91983ca52aa891605e5e65c
Showing with 41 additions and 42 deletions.
  1. +30 −31 hello_chat.opa
  2. +10 −10 hello_chat_min.opa
  3. +1 −1 resources/css.css
View
@@ -35,14 +35,13 @@ exposed @async room = Network.network(message) (Network.cloud("room"))
* @param x The message received from the chatroom
*/
function user_update(message x) {
- line = <div class="row line">
- <div class="span1 columns userpic" />
- <div class="span2 columns user">{x.author}:</div>
- <div class="span13 columns message">{x.text}
- </div>
- </div>
- #conversation =+ line
- Dom.scroll_to_bottom(#conversation)
+ line = <div class="row line">
+ <div class="span1 columns userpic" />
+ <div class="span2 columns user">{x.author}:</div>
+ <div class="span13 columns message">{x.text}</div>
+ </div>;
+ #conversation =+ line;
+ Dom.scroll_to_bottom(#conversation);
}
/**
@@ -53,10 +52,10 @@ function user_update(message x) {
* @param author The name of the author. Will be included in the message broadcasted.
*/
function broadcast(author) {
- text = Dom.get_value(#entry)
- message = ~{author, text}
- Network.broadcast(message, room)
- Dom.clear_value(#entry)
+ text = Dom.get_value(#entry);
+ message = ~{author, text};
+ Network.broadcast(message, room);
+ Dom.clear_value(#entry);
}
/**
@@ -67,22 +66,22 @@ function broadcast(author) {
* @return The user interface, ready to be sent by the server to the client on connection.
*/
function start() {
- author = Random.string(8)
- <div class="topbar">
- <div class="fill">
- <div class="container">
- <div id=#logo />
+ author = Random.string(8);
+ <div class="topbar">
+ <div class="fill">
+ <div class="container">
+ <div id=#logo />
+ </>
</>
</>
- </>
- <div id=#conversation class="container"
- onready={function(_) { Network.add_callback(user_update, room) }}></>
- <div id=#footer>
- <div class="container">
- <input id=#entry class="xlarge" onnewline={function(_) { broadcast(author) }} />
- <div class="btn primary" onclick={function(_) { broadcast(author) }}>Post</>
+ <div id=#conversation class="container"
+ onready={function(_) { Network.add_callback(user_update, room) }}></>
+ <div id=#footer>
+ <div class="container">
+ <input id=#entry class="xlarge" onnewline={function(_) { broadcast(author) }} />
+ <div class="btn primary" onclick={function(_) { broadcast(author) }}>Post</>
+ </>
</>
- </>
}
/**
@@ -97,9 +96,9 @@ function start() {
* "resources/css.css" and the user interface defined in [start].
*/
Server.start(
- Server.http,
- [ {resources: @static_resource_directory("resources")}
- , {register: ["resources/css.css"]}
- , {title: "Chat", page:start }
- ]
-)
+ Server.http,
+ [ {resources: @static_resource_directory("resources")}
+ , {register: ["resources/css.css"]}
+ , {title: "Chat", page:start }
+ ]
+);
View
@@ -33,9 +33,9 @@ room = Network.network(message) (Network.cloud("room"))
* @param x The message received from the chatroom
*/
function user_update(message x) {
- line = <div>{x.author}: {x.text}</div>
- #conversation =+ line
- Dom.scroll_to_bottom(#conversation)
+ line = <div>{x.author}: {x.text}</div>;
+ #conversation =+ line;
+ Dom.scroll_to_bottom(#conversation);
}
/**
@@ -46,10 +46,10 @@ function user_update(message x) {
* @param author The name of the author. Will be included in the message broadcasted.
*/
function broadcast(author) {
- text = Dom.get_value(#entry)
- message = {~author, ~text}
- Network.broadcast(message, room)
- Dom.clear_value(#entry)
+ text = Dom.get_value(#entry);
+ message = ~{author, text};
+ Network.broadcast(message, room);
+ Dom.clear_value(#entry);
}
/**
@@ -60,10 +60,10 @@ function broadcast(author) {
* @return The user interface, ready to be sent by the server to the client on connection.
*/
function start() {
- author = Random.string(8)
+ author = Random.string(8);
<div id=#conversation onready={function(_) { Network.add_callback(user_update, room) }} />
<input id=#entry onnewline={function(_) { broadcast(author) }} />
- <input type="button" onclick={function(_) { broadcast(author) }} value="Post" />
+ <input type="button" onclick={function(_) { broadcast(author) }} value="Post" />;
}
/**
@@ -77,4 +77,4 @@ function start() {
* embedding statically the contents of directory "resources", using the global stylesheet
* "resources/css.css" and the user interface defined in [start].
*/
-Server.start(Server.http, {title: "Chat", page: start })
+Server.start(Server.http, {title: "Chat", page: start });
View
@@ -39,4 +39,4 @@
right:0;
padding:10px 0;
text-align:left;
-}
+}

0 comments on commit 8798773

Please sign in to comment.