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

Side by Side Diff: samples/swarm/DataSource.dart

Issue 12380046: Future-ify all the html methods and add named parameters (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « samples/chat/dart_client/chat.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 part of swarmlib; 5 part of swarmlib;
6 6
7 /** The top-level collection of all sections for a user. */ 7 /** The top-level collection of all sections for a user. */
8 // TODO(jimhug): This is known as UserData in the server model. 8 // TODO(jimhug): This is known as UserData in the server model.
9 class Sections extends Collection<Section> { 9 class Sections extends Collection<Section> {
10 final List<Section> _sections; 10 final List<Section> _sections;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // add support for preloading. 216 // add support for preloading.
217 void _ensureLoaded() { 217 void _ensureLoaded() {
218 if (_htmlBody != null) return; 218 if (_htmlBody != null) return;
219 219
220 var name = '$dataUri.html'; 220 var name = '$dataUri.html';
221 if (Sections.runningFromFile) { 221 if (Sections.runningFromFile) {
222 _htmlBody = CannedData.data[name]; 222 _htmlBody = CannedData.data[name];
223 } else { 223 } else {
224 // TODO(jimhug): Remove this truly evil synchronoush xhr. 224 // TODO(jimhug): Remove this truly evil synchronoush xhr.
225 final req = new HttpRequest(); 225 final req = new HttpRequest();
226 req.open('GET', 'data/$name', false); 226 req.open('GET', 'data/$name', async: false);
227 req.send(); 227 req.send();
228 _htmlBody = req.responseText; 228 _htmlBody = req.responseText;
229 } 229 }
230 } 230 }
231 231
232 static Article decodeHeader(Feed source, Decoder decoder) { 232 static Article decodeHeader(Feed source, Decoder decoder) {
233 final id = decoder.readString(); 233 final id = decoder.readString();
234 final title = decoder.readString(); 234 final title = decoder.readString();
235 final srcUrl = decoder.readString(); 235 final srcUrl = decoder.readString();
236 final hasThumbnail = decoder.readBool(); 236 final hasThumbnail = decoder.readBool();
237 final author = decoder.readString(); 237 final author = decoder.readString();
238 final dateInSeconds = decoder.readInt(); 238 final dateInSeconds = decoder.readInt();
239 final snippet = decoder.readString(); 239 final snippet = decoder.readString();
240 final date = 240 final date =
241 new DateTime.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true) ; 241 new DateTime.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true) ;
242 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, 242 return new Article(source, id, date, title, author, srcUrl, hasThumbnail,
243 snippet); 243 snippet);
244 } 244 }
245 } 245 }
OLDNEW
« no previous file with comments | « samples/chat/dart_client/chat.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698