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

Unified Diff: client/dart.js

Issue 9226025: New dart.js bootstrap script for apps (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | client/samples/dartcombat/dartcombat.html » ('j') | client/samples/dartcombat/dartcombat.html » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dart.js
diff --git a/client/dart.js b/client/dart.js
new file mode 100644
index 0000000000000000000000000000000000000000..df24d96a2510f0c1902476310fa89032063b9f33
--- /dev/null
+++ b/client/dart.js
@@ -0,0 +1,26 @@
+// 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.
danrubel 2012/01/20 21:20:36 Do we need a "is Dart available in this browser" c
vsm 2012/01/20 21:55:27 Line 7 is that check. Note, we will probably chan
+ var scripts = document.getElementsByTagName("script");
+ var length = scripts.length;
+ for (var i = 0; i < length; ++i) {
+ if (scripts[i].type == "application/dart") {
+ var script = document.createElement('script');
+ // Remap foo.dart to foo.js.
+ // TODO:
+ // - Support in-browser compilation.
+ // - Handle inline Dart scripts.
+ if (scripts[i].src && scripts[i].src != '') {
+ script.src = scripts[i].src + '.js';
+ document.body.appendChild(script);
dgrove 2012/01/20 20:57:03 won't this break scripts that want to look at thei
vsm 2012/01/20 21:55:27 Modified to replace the original script. On 2012/
+ }
+ }
+ }
+ }, false);
+}
« no previous file with comments | « no previous file | client/samples/dartcombat/dartcombat.html » ('j') | client/samples/dartcombat/dartcombat.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698