{"action":"created","issue":{"url":"https://api.github.com/repos/angular/zone.js/issues/269","repository_url":"https://api.github.com/repos/angular/zone.js","labels_url":"https://api.github.com/repos/angular/zone.js/issues/269/labels{/name}","comments_url":"https://api.github.com/repos/angular/zone.js/issues/269/comments","events_url":"https://api.github.com/repos/angular/zone.js/issues/269/events","html_url":"https://github.com/angular/zone.js/issues/269","id":137880351,"number":269,"title":"Zone.js afterTask is called three times","user":{"login":"PavelPZ","id":2981508,"avatar_url":"https://avatars.githubusercontent.com/u/2981508?v=3","gravatar_id":"","url":"https://api.github.com/users/PavelPZ","html_url":"https://github.com/PavelPZ","followers_url":"https://api.github.com/users/PavelPZ/followers","following_url":"https://api.github.com/users/PavelPZ/following{/other_user}","gists_url":"https://api.github.com/users/PavelPZ/gists{/gist_id}","starred_url":"https://api.github.com/users/PavelPZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PavelPZ/subscriptions","organizations_url":"https://api.github.com/users/PavelPZ/orgs","repos_url":"https://api.github.com/users/PavelPZ/repos","events_url":"https://api.github.com/users/PavelPZ/events{/privacy}","received_events_url":"https://api.github.com/users/PavelPZ/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-02T13:57:50Z","updated_at":"2016-03-06T20:36:12Z","closed_at":null,"body":"doClick event of this component:\r\n\r\n```javascript\r\nimport * as core from 'angular2/core';\r\nimport {global} from 'angular2/src/facade/lang';\r\n\r\n@core.Component({\r\n  selector: 'my-app',\r\n  template: '<h1 (click)=\"doClick()\">Click</h1>'\r\n})\r\nexport class AppComponent {\r\n\r\n  constructor(private zone: core.NgZone) {//, private http: http.Http) {\r\n    zone.onTurnDone.subscribe(() => console.log('onTurnDone'));\r\n  }\r\n\r\n  doClick() {\r\n    global.zone.fork({\r\n      afterTask: function () {\r\n        console.log('After task');\r\n      }\r\n    }).run(() => setTimeout(() => { setTimeout(() => { }, 2000); }, 2000)); //afterTask is called three times\r\n  }\r\n}\r\n\r\n\r\n```\r\n\r\nproduced this console log:\r\n\r\n```javascript\r\nAfter task\r\nonTurnDone\r\nAfter task\r\nonTurnDone\r\nonTurnDone\r\nAfter task\r\nonTurnDone\r\nonTurnDone\r\n```\r\n\r\nfirst \"After task\" is printed immediatelly\r\nsecond \"After task\" is printed after two seconds\r\nthirds \"After task\" is printed after another two seconds\r\n\r\n------------------\r\nI 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\".\r\n\r\nOr is there any other possibility to use zone.js or ngZone to recognize \"action completed\" event?"},"comment":{"url":"https://api.github.com/repos/angular/zone.js/issues/comments/192983798","html_url":"https://github.com/angular/zone.js/issues/269#issuecomment-192983798","issue_url":"https://api.github.com/repos/angular/zone.js/issues/269","id":192983798,"user":{"login":"poxrud","id":3064473,"avatar_url":"https://avatars.githubusercontent.com/u/3064473?v=3","gravatar_id":"","url":"https://api.github.com/users/poxrud","html_url":"https://github.com/poxrud","followers_url":"https://api.github.com/users/poxrud/followers","following_url":"https://api.github.com/users/poxrud/following{/other_user}","gists_url":"https://api.github.com/users/poxrud/gists{/gist_id}","starred_url":"https://api.github.com/users/poxrud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poxrud/subscriptions","organizations_url":"https://api.github.com/users/poxrud/orgs","repos_url":"https://api.github.com/users/poxrud/repos","events_url":"https://api.github.com/users/poxrud/events{/privacy}","received_events_url":"https://api.github.com/users/poxrud/received_events","type":"User","site_admin":false},"created_at":"2016-03-06T20:36:12Z","updated_at":"2016-03-06T20:36:12Z","body":"@PavelPZ Looks like this is now fixed in 0.6.0"}}