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