Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: samples/chat/dart_client/chat.dart

Issue 9495007: Prepare the HTTP library for inclusion in the standalone VM (step 2) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("chat.dart"); 5 #library("chat.dart");
6 #import("dart:html"); 6 #import("dart:html");
7 #import("dart:json"); 7 #import("dart:json");
8 8
9 void main() { 9 void main() {
10 new Chat(); 10 new Chat();
11 } 11 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 void uiAddMessage(Map message) { 220 void uiAddMessage(Map message) {
221 ParagraphElement p = new Element.tag('p'); 221 ParagraphElement p = new Element.tag('p');
222 String formattedTime = formatMessageTime(message["received"]); 222 String formattedTime = formatMessageTime(message["received"]);
223 String from = message["from"]; 223 String from = message["from"];
224 String text = "$formattedTime $from "; 224 String text = "$formattedTime $from ";
225 if (message["type"] == "join") { 225 if (message["type"] == "join") {
226 text += "joined"; 226 text += "joined";
227 } else if (message["type"] == "message") { 227 } else if (message["type"] == "message") {
228 text += message["message"]; 228 text += message["message"];
229 } else if (message["type"] == "left") { 229 } else if (message["type"] == "leave") {
230 text += "left"; 230 text += "left";
231 } else { 231 } else {
232 text += "timeout"; 232 text += "timeout";
233 } 233 }
234 p.text = text; 234 p.text = text;
235 _messages.insertAdjacentElement('afterBegin', p); 235 _messages.insertAdjacentElement('afterBegin', p);
236 if (_messages.elements.length > 20) { 236 if (_messages.elements.length > 20) {
237 _messages.elements.removeLast(); 237 _messages.elements.removeLast();
238 } 238 }
239 } 239 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 Element _chatSection; 312 Element _chatSection;
313 InputElement _messageInput; 313 InputElement _messageInput;
314 Element _messages; 314 Element _messages;
315 Element _statusText; 315 Element _statusText;
316 316
317 String _session = null; 317 String _session = null;
318 int _nextMessage = 0; 318 int _nextMessage = 0;
319 XMLHttpRequest _pollRequest = null; 319 XMLHttpRequest _pollRequest = null;
320 320
321 } 321 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698