OLD | NEW |
---|---|
(Empty) | |
1 library chrome; | |
2 | |
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
4 // for details. All rights reserved. Use of this source code is governed by a | |
5 // BSD-style license that can be found in the LICENSE file. | |
6 | |
7 // DO NOT EDIT | |
8 // Auto-generated dart:chrome library. | |
9 | |
10 | |
11 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
12 // for details. All rights reserved. Use of this source code is governed by a | |
13 // BSD-style license that can be found in the LICENSE file. | |
14 | |
15 | |
16 // This is an example of exposing chrome APIs in Dart and will be replaced with | |
17 // the proper implementation in the future. | |
18 | |
19 class AppModule { | |
20 AppModule._(); | |
21 | |
22 WindowModule get window => new WindowModule._(); | |
23 } | |
24 | |
25 class WindowModule { | |
26 WindowModule._(); | |
27 | |
28 void create(String url) { | |
29 var chrome = JS('', 'chrome'); | |
30 | |
31 if (chrome == null) { | |
32 throw new UnsupportedError('Not supported by current browser'); | |
33 } | |
34 var app = JS('', '#.app', chrome); | |
35 if (app == null) { | |
36 throw new UnsupportedError('Not supported by current browser'); | |
37 } | |
ahe
2013/01/18 12:52:15
You could move the above checks to the AppModule c
| |
38 var window = JS('', '#.window', app); | |
39 if (app == null) { | |
40 throw new UnsupportedError('Not supported by current browser'); | |
41 } | |
ahe
2013/01/18 12:52:15
You might want to check this in the constructor of
| |
42 JS('void', '#.create(#)', window, url); | |
43 } | |
44 } | |
45 | |
46 final app = new AppModule._(); | |
OLD | NEW |