Index: lib/polymer.dart |
diff --git a/lib/polymer.dart b/lib/polymer.dart |
index c949a496aef00d73ddcebf859d63c681413efd17..b4265bd32581deed2c92bc216240ce490f4f01da 100644 |
--- a/lib/polymer.dart |
+++ b/lib/polymer.dart |
@@ -15,19 +15,18 @@ import 'dart:async'; |
import 'dart:mirrors'; |
import 'package:mdv/mdv.dart' as mdv; |
-import 'package:observe/observe.dart' show Observable; |
+import 'package:observe/src/microtask.dart'; |
import 'package:path/path.dart' as path; |
import 'polymer_element.dart' show registerPolymerElement; |
export 'package:custom_element/custom_element.dart'; |
export 'package:observe/observe.dart'; |
+export 'package:observe/src/microtask.dart'; |
-export 'event.dart'; |
export 'observe.dart'; |
export 'observe_html.dart'; |
export 'polymer_element.dart'; |
export 'safe_html.dart'; |
-export 'scoped_css.dart'; |
/** Annotation used to automatically register polymer elements. */ |
@@ -54,20 +53,23 @@ const polymerInitMethod = const _InitPolymerAnnotation(); |
* |
* The urls in [elementLibraries] can be absolute or relative to [srcUrl]. |
*/ |
-initPolymer(List<String> elementLibraries, void userMain(), [String srcUrl]) { |
- new Timer.periodic(new Duration(milliseconds: 125), |
- (_) => Observable.dirtyCheck()); |
- |
- // TODO(jmesserly): mdv should use initMdv instead of mdv.initialize. |
- mdv.initialize(); |
- for (var lib in elementLibraries) { |
- _registerPolymerElementsOf(lib, srcUrl); |
- } |
- userMain(); |
+void initPolymer(List<String> elementLibraries, void userMain(), [String srcUrl]) { |
+ wrapMicrotask(() { |
+ // DOM events don't yet go through microtasks, so we catch those here. |
+ new Timer.periodic(new Duration(milliseconds: 125), |
+ (_) => performMicrotaskCheckpoint()); |
+ |
+ // TODO(jmesserly): mdv should use initMdv instead of mdv.initialize. |
+ mdv.initialize(); |
+ for (var lib in elementLibraries) { |
+ _registerPolymerElementsOf(lib, srcUrl); |
+ } |
+ userMain(); |
+ })(); |
} |
/** All libraries in the current isolate. */ |
-var _libs = currentMirrorSystem().libraries; |
+final _libs = currentMirrorSystem().libraries; |
/** |
* Reads the library at [uriString] (which can be an absolute URI or a relative |