@@ -88,7 +88,8 @@ class VmTurnZone {
88
88
bool _errorThrownFromOnRun = false ;
89
89
90
90
var _currentlyInTurn = false ;
91
- _onRunBase (async .Zone self, async .ZoneDelegate delegate, async .Zone zone, fn ()) {
91
+
92
+ dynamic _onRunBase (async .Zone self, async .ZoneDelegate delegate, async .Zone zone, fn ()) {
92
93
_runningInTurn++ ;
93
94
try {
94
95
if (! _currentlyInTurn) {
@@ -105,28 +106,29 @@ class VmTurnZone {
105
106
if (_runningInTurn == 0 ) _finishTurn (zone, delegate);
106
107
}
107
108
}
109
+
108
110
// Called from the parent zone.
109
- _onRun (async .Zone self, async .ZoneDelegate delegate, async .Zone zone, fn ()) =>
111
+ dynamic _onRun (async .Zone self, async .ZoneDelegate delegate, async .Zone zone, fn ()) =>
110
112
_onRunBase (self, delegate, zone, () => delegate.run (zone, fn));
111
113
112
- _onRunUnary (async .Zone self, async .ZoneDelegate delegate, async .Zone zone,
113
- fn (args), args) =>
114
+ dynamic _onRunUnary (async .Zone self, async .ZoneDelegate delegate, async .Zone zone,
115
+ fn (args), args) =>
114
116
_onRunBase (self, delegate, zone, () => delegate.runUnary (zone, fn, args));
115
117
116
- _onScheduleMicrotask (async .Zone self, async .ZoneDelegate delegate,
117
- async .Zone zone, fn ()) {
118
+ void _onScheduleMicrotask (async .Zone self, async .ZoneDelegate delegate, async .Zone zone, fn ()) {
118
119
onScheduleMicrotask (() => delegate.run (zone, fn));
119
120
if (_runningInTurn == 0 && ! _inFinishTurn) _finishTurn (zone, delegate);
120
121
}
121
122
122
- _uncaughtError (async .Zone self, async .ZoneDelegate delegate, async .Zone zone,
123
- e, StackTrace s) {
123
+ void _uncaughtError (async .Zone self, async .ZoneDelegate delegate, async .Zone zone,
124
+ e, StackTrace s) {
124
125
if (! _errorThrownFromOnRun) onError (e, s, _longStacktrace);
125
126
_errorThrownFromOnRun = false ;
126
127
}
127
128
128
129
var _inFinishTurn = false ;
129
- _finishTurn (zone, delegate) {
130
+
131
+ void _finishTurn (zone, delegate) {
130
132
if (_inFinishTurn) return ;
131
133
_inFinishTurn = true ;
132
134
try {
@@ -218,15 +220,27 @@ class VmTurnZone {
218
220
219
221
/**
220
222
* Runs [body] in the inner zone and returns whatever it returns.
223
+ *
224
+ * In a typical app where the inner zone is the Angular zone, this allows one to make use of the
225
+ * Angular's auto digest mechanism.
226
+ *
227
+ * VmTurnZone zone = <ref to app.zone>;
228
+ *
229
+ * void functionCalledFromJS() {
230
+ * zone.run(() {
231
+ * // auto-digest will run after this function is called from JS
232
+ * })
233
+ * }
221
234
*/
222
235
dynamic run (body ()) => _innerZone.run (body);
223
236
224
237
/**
225
238
* Runs [body] in the outer zone and returns whatever it returns.
226
- * In a typical app where the inner zone is the Angular zone, this allows
227
- * one to escape Angular's auto-digest mechanism.
228
239
*
229
- * myFunction(VmTurnZone zone, Element element) {
240
+ * In a typical app where the inner zone is the Angular zone, this allows one to escape Angular's
241
+ * auto-digest mechanism.
242
+ *
243
+ * void myFunction(VmTurnZone zone, Element element) {
230
244
* element.onClick.listen(() {
231
245
* // auto-digest will run after element click.
232
246
* });
0 commit comments