Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

feat(Scope): Scope specified custom VmTurnZone.onScheduleMicrotask metho... #984

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/core/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ class RootScope extends Scope {
{
_zone.onTurnDone = apply;
_zone.onError = (e, s, ls) => _exceptionHandler(e, s);
_zone.onScheduleMicrotask = runAsync;
}

RootScope get rootScope => this;
Expand Down
6 changes: 3 additions & 3 deletions lib/core/zone.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class VmTurnZone {
/// an "inner" [Zone], which is a child of the outer [Zone].
async.Zone _innerZone;

ZoneScheduleMicrotask defaultOnScheduleMicrotask;
ZoneScheduleMicrotask onScheduleMicrotask;

/**
* Associates with this
Expand Down Expand Up @@ -115,8 +115,8 @@ class VmTurnZone {

_onScheduleMicrotask(async.Zone self, async.ZoneDelegate delegate,
async.Zone zone, fn()) {
if (defaultOnScheduleMicrotask != null) {
return defaultOnScheduleMicrotask(fn);
if (onScheduleMicrotask != null) {
return onScheduleMicrotask(fn);
}

_asyncQueue.add(() => delegate.run(zone, fn));
Expand Down
5 changes: 2 additions & 3 deletions test/core/templateurl_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ void main() {
..whenGET('PREFIX:simple.css').respond('.hello{}');

var element = e('<div><html-and-css log>ignore</html-and-css><div>');
zone.run(() {
compile([element], directives)(injector, [element]);
});
compile([element], directives)(injector, [element]);

microLeap();
backend.flush();
microLeap();

Expand Down
8 changes: 4 additions & 4 deletions test/core/zone_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void main() {
});
log('onTurnDone(end)');
};
zone.defaultOnScheduleMicrotask = (microTaskFn) {
zone.onScheduleMicrotask = (microTaskFn) {
log('onScheduleMicrotask(begin)');
microtaskResult = microTaskFn();
log('onScheduleMicrotask(end)');
Expand All @@ -478,7 +478,7 @@ void main() {
});
log('onTurnDone(end)');
};
zone.defaultOnScheduleMicrotask = (microTaskFn) {
zone.onScheduleMicrotask = (microTaskFn) {
log('onScheduleMicrotask(begin)');
microTaskFn();
log('onScheduleMicrotask(end)');
Expand All @@ -500,7 +500,7 @@ void main() {
zone.onTurnDone = () {
log('onTurnDone');
};
zone.defaultOnScheduleMicrotask = (microTaskFn) {
zone.onScheduleMicrotask = (microTaskFn) {
log('onScheduleMicrotask(begin)');
microTaskFn();
log('onScheduleMicrotask(end)');
Expand Down Expand Up @@ -528,7 +528,7 @@ void main() {
zone.onTurnDone = () {
log('onTurnDone');
};
zone.defaultOnScheduleMicrotask = (microTaskFn) {
zone.onScheduleMicrotask = (microTaskFn) {
log('onScheduleMicrotask(begin)');
microTaskFn();
log('onScheduleMicrotask(end)');
Expand Down