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

Side by Side Diff: client/samples/swarm/App.dart

Issue 8363040: Implement measurement using futures (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: take2 Created 9 years, 1 month 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) 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 /** 5 /**
6 * The base class that should be extended by all HTML applications. 6 * The base class that should be extended by all HTML applications.
7 * 7 *
8 * It should both be easy to use for users coming over from JavaScript, but 8 * It should both be easy to use for users coming over from JavaScript, but
9 * also offer a clear notion of OO encapsulation. 9 * also offer a clear notion of OO encapsulation.
10 * 10 *
11 * This class or something similar belongs in the standard DOM library. 11 * This class or something similar belongs in the standard DOM library.
12 */ 12 */
13 class App { 13 class App {
14 14
15 App() {} 15 App() {}
16 16
17 /** Begins executing code in this [App]. */ 17 /** Begins executing code in this [App]. */
18 void run() { 18 void run() {
19 // If the script is async, by the time we get here the DOM content may 19 // If the script is async, by the time we get here the DOM content may
20 // already be loaded, so waiting on the DOMContentLoaded event is a no-op. 20 // already be loaded, so waiting on the DOMContentLoaded event is a no-op.
21 // Guard against this by checking whether the document readiness state has 21 // Guard against this by checking whether the document readiness state has
22 // gotten as far as "interactive". (We believe the transition to 22 // gotten as far as "interactive". (We believe the transition to
23 // "interactive" is when the DOMContentLoaded event fires, but haven't 23 // "interactive" is when the DOMContentLoaded event fires, but haven't
24 // found that specified; if that's not true it leaves a race bug.) 24 // found that specified; if that's not true it leaves a race bug.)
25 if (document.readyState == "interactive" || 25 if (document.readyState == "interactive" ||
26 document.readyState == "complete" || 26 document.readyState == "complete" ||
27 document.readyState == "loaded") { 27 document.readyState == "loaded") {
28 this.onLoad(); 28 window.setTimeout(() => onLoad(), 0);
arv (Not doing code reviews) 2011/10/27 05:50:24 this could use a comment
Jacob 2011/10/27 20:59:25 Done.
29 } else { 29 } else {
30 window.on.contentLoaded.add( 30 window.on.contentLoaded.add(
31 // TODO(sigmund): Consider eliminating the call to "wrap", for 31 // TODO(sigmund): Consider eliminating the call to "wrap", for
32 // instance, modify event listeners to always wrap, or extend DOM code 32 // instance, modify event listeners to always wrap, or extend DOM code
33 // to intercept the beginning & end of each event loop 33 // to intercept the beginning & end of each event loop
34 EventBatch.wrap((Event event) => onLoad())); 34 EventBatch.wrap((Event event) => onLoad()));
35 } 35 }
36 } 36 }
37 37
38 /** 38 /**
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // TODO(jmesserly): Several problems with this: 98 // TODO(jmesserly): Several problems with this:
99 // * How do we authenticate against the server? 99 // * How do we authenticate against the server?
100 // * How do we talk to a server other than thump? 100 // * How do we talk to a server other than thump?
101 assert(url.startsWith('/')); 101 assert(url.startsWith('/'));
102 return 'http://thump.googleplex.com' + url; 102 return 'http://thump.googleplex.com' + url;
103 } else { 103 } else {
104 return url; 104 return url;
105 } 105 }
106 } 106 }
107 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698