Chromium Code Reviews| 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 /** | 5 /** |
| 6 * This library exports all of the commonly used functions and types for | 6 * This library exports all of the commonly used functions and types for |
| 7 * building UI's. | 7 * building UI's. |
| 8 * | 8 * |
| 9 * See this article for more information: | 9 * See this article for more information: |
| 10 * <http://www.dartlang.org/articles/dart-web-components/>. | 10 * <http://www.dartlang.org/articles/dart-web-components/>. |
| 11 */ | 11 */ |
| 12 library polymer; | 12 library polymer; |
| 13 | 13 |
| 14 import 'dart:async'; | |
| 15 import 'dart:mirrors'; | |
|
Jennifer Messerly
2013/07/27 02:18:44
show currentMirrorSystem?
Siggi Cherem (dart-lang)
2013/07/30 00:10:29
Done.
| |
| 16 | |
| 17 import "package:mdv/mdv.dart" as mdv; | |
| 18 import 'package:observe/observe.dart' show Observable; | |
| 19 | |
| 14 export 'custom_element.dart'; | 20 export 'custom_element.dart'; |
| 15 export 'event.dart'; | 21 export 'event.dart'; |
| 16 export 'observe.dart'; | 22 export 'observe.dart'; |
|
Jennifer Messerly
2013/07/27 02:18:44
also re-export 'package:observe/observe.dart"?
Siggi Cherem (dart-lang)
2013/07/30 00:10:29
Done.
| |
| 17 export 'observe_html.dart'; | 23 export 'observe_html.dart'; |
| 18 export 'polymer_element.dart'; | 24 export 'polymer_element.dart'; |
| 19 export 'safe_html.dart'; | 25 export 'safe_html.dart'; |
| 20 export 'scoped_css.dart'; | 26 export 'scoped_css.dart'; |
| 27 | |
| 28 | |
| 29 | |
| 30 /** All libraries in the current isolate. */ | |
| 31 var _libs = currentMirrorSystem().libraries; | |
| 32 | |
| 33 /** Runs the _init method of the library at [uri]. */ | |
| 34 void _runInitOf(String uri) { | |
| 35 try { | |
| 36 var lib = _libs[Uri.parse(uri)]; | |
| 37 lib.invoke(const Symbol("_init"), const []); | |
|
Jennifer Messerly
2013/07/27 02:18:44
lookup "_init" symbol rather than try+catch?
shou
Siggi Cherem (dart-lang)
2013/07/30 00:10:29
Done. Then found out that "_init" gives me errors
| |
| 38 } catch(e) { } | |
| 39 } | |
| 40 | |
| 41 /** | |
| 42 * Initializes a polymer application by: setting up polling for observable | |
| 43 * changes, initializing MDV, running the `_init` method on each | |
| 44 * library in [elementLibraries] and then invoking [userMain]. | |
| 45 */ | |
| 46 initializePolymer(List<String> elementLibraries, Function userMain) { | |
|
Jennifer Messerly
2013/07/27 02:18:44
initPolymer?
Jennifer Messerly
2013/07/27 02:18:44
"void userMain()" ?
Siggi Cherem (dart-lang)
2013/07/30 00:10:29
Done.
Siggi Cherem (dart-lang)
2013/07/30 00:10:29
Done.
| |
| 47 new Timer.periodic(new Duration(milliseconds: 60), | |
|
Jennifer Messerly
2013/07/27 02:18:44
it's arbitrary either way, but consider using 125m
Siggi Cherem (dart-lang)
2013/07/30 00:10:29
Done.
| |
| 48 (_) => Observable.dirtyCheck()); | |
| 49 mdv.initialize(); | |
|
Jennifer Messerly
2013/07/27 02:18:44
TODO(jmesserly): mdv should use initializeMdv inst
Siggi Cherem (dart-lang)
2013/07/30 00:10:29
Done.
| |
| 50 for (var lib in elementLibraries) { | |
| 51 _runInitOf(lib); | |
| 52 } | |
| 53 userMain(); | |
| 54 } | |
| OLD | NEW |