Index: sdk/lib/async/event_loop.dart |
diff --git a/sdk/lib/async/event_loop.dart b/sdk/lib/async/event_loop.dart |
index 94137da655b61c61739078757e06e6c8a36c0a9d..42c25ecdbce26ea8f2741eb05c1e497bed612445 100644 |
--- a/sdk/lib/async/event_loop.dart |
+++ b/sdk/lib/async/event_loop.dart |
@@ -43,21 +43,21 @@ void _scheduleAsyncCallback(callback) { |
* or DOM events). |
* |
* Warning: it is possible to starve the DOM by registering asynchronous |
- * callbacks through this method. For example the following program will |
- * run the callbacks without ever giving the Timer callback a chance to execute: |
+ * callbacks through this method. For example the following program runs |
+ * the callbacks without ever giving the Timer callback a chance to execute: |
* |
* Timer.run(() { print("executed"); }); // Will never be executed; |
* foo() { |
- * asyncRun(foo); // Schedules [foo] in front of other events. |
+ * scheduleMicrotask(foo); // Schedules [foo] in front of other events. |
* } |
* main() { |
* foo(); |
* } |
*/ |
-void runAsync(void callback()) { |
+void scheduleMicrotask(void callback()) { |
if (Zone.current == Zone.ROOT) { |
- // No need to bind the callback. We know that the root's runAsync will |
- // be invoked in the root zone. |
+ // No need to bind the callback. We know that the root's scheduleMicrotask |
+ // will be invoked in the root zone. |
Zone.current.scheduleMicrotask(callback); |
return; |
} |
@@ -65,6 +65,14 @@ void runAsync(void callback()) { |
Zone.current.bindCallback(callback, runGuarded: true)); |
} |
+/** |
+ * *DEPRECATED*. Use [scheduleMicrotask] instead. |
+ */ |
+@deprecated |
+void runAsync(void callback()) { |
+ scheduleMicrotask(callback); |
+} |
+ |
class _AsyncRun { |
/** Enqueues the given callback before any other event in the event-loop. */ |
external static void _enqueueImmediate(void callback()); |