Index: client/dart.js |
diff --git a/client/dart.js b/client/dart.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7ccf42b9e6609934521c87add98d9654751d9036 |
--- /dev/null |
+++ b/client/dart.js |
@@ -0,0 +1,27 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+// Bootstrap support for Dart scripts on the page as this script. |
+ |
+if (!document.implementation.hasFeature('dart', '1.0')) { |
+ window.addEventListener("DOMContentLoaded", function (e) { |
+ // Fall back to compiled JS. |
+ var scripts = document.getElementsByTagName("script"); |
+ var length = scripts.length; |
+ for (var i = 0; i < length; ++i) { |
+ if (scripts[i].type == "application/dart") { |
+ // Remap foo.dart to foo.js. |
+ // TODO: |
+ // - Support in-browser compilation. |
+ // - Handle inline Dart scripts. |
+ if (scripts[i].src && scripts[i].src != '') { |
+ var script = document.createElement('script'); |
+ script.src = scripts[i].src + '.js'; |
+ var parent = scripts[i].parentNode; |
+ parent.replaceChild(script, scripts[i]); |
dgrove
2012/01/20 22:01:13
does this really work? (ie, the script starts exec
|
+ } |
+ } |
+ } |
+ }, false); |
+} |