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

Unified Diff: pkg/polymer/lib/src/instance.dart

Issue 41293002: Fixes from polymer.dart API review (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made Job a part of polymer Created 7 years, 2 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
Index: pkg/polymer/lib/src/instance.dart
diff --git a/pkg/polymer/lib/src/instance.dart b/pkg/polymer/lib/src/instance.dart
index ed5d1fe17efffc0caf8f10164d7934db3246c231..eea5073151ba91fdfd578d64b949bb423ec70a40 100644
--- a/pkg/polymer/lib/src/instance.dart
+++ b/pkg/polymer/lib/src/instance.dart
@@ -82,7 +82,7 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
Map<String, StreamSubscription> _observers;
bool _unbound; // lazy-initialized
- Job _unbindAllJob;
+ _Job _unbindAllJob;
StreamSubscription _propertyObserver;
@@ -121,17 +121,6 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
// TODO(jmesserly): Polymer does not have this feature. Reconcile.
ShadowRoot getShadowRoot(String customTagName) => _shadowRoots[customTagName];
- /**
- * Invoke [callback] in [wait], unless the job is re-registered,
- * which resets the timer. For example:
- *
- * _myJob = job(_myJob, callback, const Duration(milliseconds: 100));
- *
- * Returns a job handle which can be used to re-register a job.
- */
- Job job(Job job, void callback(), Duration wait) =>
- runJob(job, callback, wait);
-
void polymerCreated() {
if (this.ownerDocument.window != null || alwaysPrepare ||
_preparingElements > 0) {
@@ -455,7 +444,7 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
void asyncUnbindAll() {
if (_unbound == true) return;
_unbindLog.fine('[$localName] asyncUnbindAll');
- _unbindAllJob = job(_unbindAllJob, unbindAll, const Duration(seconds: 0));
+ _unbindAllJob = _runJob(_unbindAllJob, unbindAll, Duration.ZERO);
}
void unbindAll() {
@@ -889,7 +878,7 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
Timer asyncTimer(void method(), Duration timeout) {
// when polyfilling Object.observe, ensure changes
// propagate before executing the async method
- platform.flush();
+ scheduleMicrotask(Observable.dirtyCheck);
return new Timer(timeout, method);
}
@@ -905,7 +894,7 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
int async(RequestAnimationFrameCallback method) {
// when polyfilling Object.observe, ensure changes
// propagate before executing the async method
- platform.flush();
+ scheduleMicrotask(Observable.dirtyCheck);
return window.requestAnimationFrame(method);
}

Powered by Google App Engine
This is Rietveld 408576698