-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Description
doClick event of this component:
import * as core from 'angular2/core';
import {global} from 'angular2/src/facade/lang';
@core.Component({
selector: 'my-app',
template: '<h1 (click)="doClick()">Click</h1>'
})
export class AppComponent {
constructor(private zone: core.NgZone) {//, private http: http.Http) {
zone.onTurnDone.subscribe(() => console.log('onTurnDone'));
}
doClick() {
global.zone.fork({
afterTask: function () {
console.log('After task');
}
}).run(() => setTimeout(() => { setTimeout(() => { }, 2000); }, 2000)); //afterTask is called three times
}
}
produced this console log:
After task
onTurnDone
After task
onTurnDone
onTurnDone
After task
onTurnDone
onTurnDonefirst "After task" is printed immediatelly
second "After task" is printed after two seconds
thirds "After task" is printed after another two seconds
I am using Flux to record x play flux actions (example of such action is "doClick"). For playing recorder actions I need to play them in sync. I try to use zone.js to recognize "action is completed".
Or is there any other possibility to use zone.js or ngZone to recognize "action completed" event?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels