| OLD | NEW |
| 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 * |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * Erase the static splash screen. | 59 * Erase the static splash screen. |
| 60 * | 60 * |
| 61 * Assumption: if a splash screen exists, an element #appSplash contains it. | 61 * Assumption: if a splash screen exists, an element #appSplash contains it. |
| 62 */ | 62 */ |
| 63 void eraseSplashScreen() { | 63 void eraseSplashScreen() { |
| 64 final splash = document.query("#appSplash"); | 64 final splash = document.query("#appSplash"); |
| 65 // Delete it if found, but it's okay for it not to be -- maybe | 65 // Delete it if found, but it's okay for it not to be -- maybe |
| 66 // somebody just didn't want to use our splash mechanism. | 66 // somebody just didn't want to use our splash mechanism. |
| 67 if (splash !== null) { | 67 if (splash != null) { |
| 68 splash.remove(); | 68 splash.remove(); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Swaps and reloads the app cache if an update is ready. Returns false if | 73 * Swaps and reloads the app cache if an update is ready. Returns false if |
| 74 * an update is not ready. | 74 * an update is not ready. |
| 75 */ | 75 */ |
| 76 bool swapAndReloadCache() { | 76 bool swapAndReloadCache() { |
| 77 DOMApplicationCache appCache = window.applicationCache; | 77 DOMApplicationCache appCache = window.applicationCache; |
| 78 if (appCache.status !== DOMApplicationCache.UPDATEREADY) { | 78 if (!identical(appCache.status, DOMApplicationCache.UPDATEREADY)) { |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 print('App cache update ready, now swapping...'); | 82 print('App cache update ready, now swapping...'); |
| 83 window.applicationCache.swapCache(); | 83 window.applicationCache.swapCache(); |
| 84 print('App cache swapped, now reloading page...'); | 84 print('App cache swapped, now reloading page...'); |
| 85 window.location.reload(); | 85 window.location.reload(); |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 100 // TODO(jmesserly): Several problems with this: | 100 // TODO(jmesserly): Several problems with this: |
| 101 // * How do we authenticate against the server? | 101 // * How do we authenticate against the server? |
| 102 // * How do we talk to a server other than thump? | 102 // * How do we talk to a server other than thump? |
| 103 assert(url.startsWith('/')); | 103 assert(url.startsWith('/')); |
| 104 return 'http://thump.googleplex.com$url'; | 104 return 'http://thump.googleplex.com$url'; |
| 105 } else { | 105 } else { |
| 106 return url; | 106 return url; |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 } | 109 } |
| OLD | NEW |