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

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

Issue 12212200: "Reverting 18531" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/isolate_html/isolate_sample.dart ('k') | samples/swarm/SwarmViews.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 /** 7 /**
8 * The base class that should be extended by all HTML applications. 8 * The base class that should be extended by all HTML applications.
9 * 9 *
10 * It should both be easy to use for users coming over from JavaScript, but 10 * It should both be easy to use for users coming over from JavaScript, but
11 * also offer a clear notion of OO encapsulation. 11 * also offer a clear notion of OO encapsulation.
12 * 12 *
13 * This class or something similar belongs in the standard DOM library. 13 * This class or something similar belongs in the standard DOM library.
14 */ 14 */
15 class App { 15 class App {
16 16
17 App() {} 17 App() {}
18 18
19 /** Begins executing code in this [App]. */ 19 /** Begins executing code in this [App]. */
20 void run() { 20 void run() {
21 // If the script is async, by the time we get here the DOM content may 21 // If the script is async, by the time we get here the DOM content may
22 // already be loaded, so waiting on the DOMContentLoaded event is a no-op. 22 // already be loaded, so waiting on the DOMContentLoaded event is a no-op.
23 // Guard against this by checking whether the document readiness state has 23 // Guard against this by checking whether the document readiness state has
24 // gotten as far as "interactive". (We believe the transition to 24 // gotten as far as "interactive". (We believe the transition to
25 // "interactive" is when the DOMContentLoaded event fires, but haven't 25 // "interactive" is when the DOMContentLoaded event fires, but haven't
26 // found that specified; if that's not true it leaves a race bug.) 26 // found that specified; if that's not true it leaves a race bug.)
27 if (document.readyState == "interactive" || 27 if (document.readyState == "interactive" ||
28 document.readyState == "complete" || 28 document.readyState == "complete" ||
29 document.readyState == "loaded") { 29 document.readyState == "loaded") {
30 // We use a timer to insure that onLoad is always called in an async 30 // We use setTimeout to insure that onLoad is always called in an async
31 // manner even if the document is already loaded. 31 // manner even if the document is already loaded.
32 Timer.run(onLoad); 32 window.setTimeout(() => onLoad(), 0);
33 } else { 33 } else {
34 window.onContentLoaded.listen( 34 window.onContentLoaded.listen(
35 // TODO(sigmund): Consider eliminating the call to "wrap", for 35 // TODO(sigmund): Consider eliminating the call to "wrap", for
36 // instance, modify event listeners to always wrap, or extend DOM code 36 // instance, modify event listeners to always wrap, or extend DOM code
37 // to intercept the beginning & end of each event loop 37 // to intercept the beginning & end of each event loop
38 EventBatch.wrap((Event event) => onLoad())); 38 EventBatch.wrap((Event event) => onLoad()));
39 } 39 }
40 } 40 }
41 41
42 /** 42 /**
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // TODO(jmesserly): Several problems with this: 102 // TODO(jmesserly): Several problems with this:
103 // * How do we authenticate against the server? 103 // * How do we authenticate against the server?
104 // * How do we talk to a server other than thump? 104 // * How do we talk to a server other than thump?
105 assert(url.startsWith('/')); 105 assert(url.startsWith('/'));
106 return 'http://thump.googleplex.com$url'; 106 return 'http://thump.googleplex.com$url';
107 } else { 107 } else {
108 return url; 108 return url;
109 } 109 }
110 } 110 }
111 } 111 }
OLDNEW
« no previous file with comments | « samples/isolate_html/isolate_sample.dart ('k') | samples/swarm/SwarmViews.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698