Index: sdk/lib/chrome/dart2js/chrome_dart2js.dart |
diff --git a/sdk/lib/chrome/dart2js/chrome_dart2js.dart b/sdk/lib/chrome/dart2js/chrome_dart2js.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9ab5df76c696946e0dabee807690710ee49f56c2 |
--- /dev/null |
+++ b/sdk/lib/chrome/dart2js/chrome_dart2js.dart |
@@ -0,0 +1,46 @@ |
+library chrome; |
+ |
+// Copyright (c) 2013, 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. |
+ |
+// DO NOT EDIT |
+// Auto-generated dart:chrome library. |
+ |
+ |
+// 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. |
+ |
+ |
+// This is an example of exposing chrome APIs in Dart and will be replaced with |
+// the proper implementation in the future. |
+ |
+class AppModule { |
+ AppModule._(); |
+ |
+ WindowModule get window => new WindowModule._(); |
+} |
+ |
+class WindowModule { |
+ WindowModule._(); |
+ |
+ void create(String url) { |
+ var chrome = JS('', 'chrome'); |
+ |
+ if (chrome == null) { |
+ throw new UnsupportedError('Not supported by current browser'); |
+ } |
+ var app = JS('', '#.app', chrome); |
+ if (app == null) { |
+ throw new UnsupportedError('Not supported by current browser'); |
+ } |
ahe
2013/01/18 12:52:15
You could move the above checks to the AppModule c
|
+ var window = JS('', '#.window', app); |
+ if (app == null) { |
+ throw new UnsupportedError('Not supported by current browser'); |
+ } |
ahe
2013/01/18 12:52:15
You might want to check this in the constructor of
|
+ JS('void', '#.create(#)', window, url); |
+ } |
+} |
+ |
+final app = new AppModule._(); |