| OLD | NEW |
| 1 // Copyright (c) 2012, 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 // Bootstrap support for Dart scripts on the page as this script. | 5 // Bootstrap support for Dart scripts on the page as this script. |
| 6 if (navigator.webkitStartDart) { | 6 if (navigator.webkitStartDart) { |
| 7 var expirationDate = navigator.webkitStartDart(); | 7 if (!navigator.webkitStartDart()) { |
| 8 if (expirationDate) { | 8 document.body.innerHTML = 'This build has expired. Please download a new Da
rtium at http://www.dartlang.org/dartium/index.html'; |
| 9 document.body.innerHTML = 'This build has expired on ' + expirationDate + '.
Please download a new Dartium at http://www.dartlang.org/dartium/index.html'; | |
| 10 } | 9 } |
| 11 } else { | 10 } else { |
| 12 // TODO: | 11 // TODO: |
| 13 // - Support in-browser compilation. | 12 // - Support in-browser compilation. |
| 14 // - Handle inline Dart scripts. | 13 // - Handle inline Dart scripts. |
| 15 window.addEventListener("DOMContentLoaded", function (e) { | 14 window.addEventListener("DOMContentLoaded", function (e) { |
| 16 // Fall back to compiled JS. Run through all the scripts and | 15 // Fall back to compiled JS. Run through all the scripts and |
| 17 // replace them if they have a type that indicate that they source | 16 // replace them if they have a type that indicate that they source |
| 18 // in Dart code. | 17 // in Dart code. |
| 19 // | 18 // |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 var result = null; | 227 var result = null; |
| 229 var listener = function (e) { | 228 var listener = function (e) { |
| 230 result = JSON.parse(e.data); | 229 result = JSON.parse(e.data); |
| 231 }; | 230 }; |
| 232 window.addEventListener(source, listener, false); | 231 window.addEventListener(source, listener, false); |
| 233 dispatchEvent(target, [source, serialized]); | 232 dispatchEvent(target, [source, serialized]); |
| 234 window.removeEventListener(source, listener, false); | 233 window.removeEventListener(source, listener, false); |
| 235 return deserialize(result); | 234 return deserialize(result); |
| 236 } | 235 } |
| 237 })(); | 236 })(); |
| OLD | NEW |