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

Unified Diff: lib/polymer.dart

Issue 20863002: Introduce boot.js: this finally makes it possible to load and run Todomvc (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: Created 7 years, 5 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
« lib/observe.dart ('K') | « lib/observe.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/polymer.dart
diff --git a/lib/polymer.dart b/lib/polymer.dart
index b81a01d3001886e591acfc09832317ca57c5e804..791273a28e9e57f5defcef755f9c2224716a5c1e 100644
--- a/lib/polymer.dart
+++ b/lib/polymer.dart
@@ -11,6 +11,12 @@
*/
library polymer;
+import 'dart:async';
+import 'dart:mirrors';
Jennifer Messerly 2013/07/27 02:18:44 show currentMirrorSystem?
Siggi Cherem (dart-lang) 2013/07/30 00:10:29 Done.
+
+import "package:mdv/mdv.dart" as mdv;
+import 'package:observe/observe.dart' show Observable;
+
export 'custom_element.dart';
export 'event.dart';
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.
@@ -18,3 +24,31 @@ export 'observe_html.dart';
export 'polymer_element.dart';
export 'safe_html.dart';
export 'scoped_css.dart';
+
+
+
+/** All libraries in the current isolate. */
+var _libs = currentMirrorSystem().libraries;
+
+/** Runs the _init method of the library at [uri]. */
+void _runInitOf(String uri) {
+ try {
+ var lib = _libs[Uri.parse(uri)];
+ 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
+ } catch(e) { }
+}
+
+/**
+ * Initializes a polymer application by: setting up polling for observable
+ * changes, initializing MDV, running the `_init` method on each
+ * library in [elementLibraries] and then invoking [userMain].
+ */
+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.
+ 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.
+ (_) => Observable.dirtyCheck());
+ 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.
+ for (var lib in elementLibraries) {
+ _runInitOf(lib);
+ }
+ userMain();
+}
« lib/observe.dart ('K') | « lib/observe.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698