You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
I'm trying to implement simple zone.afterTask and beforeTask hooks but though code ain't throwing any error , those methods are never getting called.
I searched Zone repo in github , and couldn't find any reference to these methods in the source code apart from the ones that's used in the example. counting example does use afterTask and beforeTask but I've set a debugger and saw those methods are never getting called in their example as well .
It looks like these methods have been deprecated , If not kindly let me know what I'm doing wrong.
Here's my code -
import { Component } from 'angular2/core';
@Component({
template: `
<div>
<p>Basic use of Zone</p>
<button (click)="startTask()">Start Task</button>
<p> Time taken {{timeTaken}}</p>
</div>
`
})
export class HelloZone {
timeTaken: any;
task1(){
for (let i = 0; i < 1e5; i++);
}
startTask() {
let startTime;
let myZone = Zone.parent.fork({
beforeTask: function() {
startTime = new Date();
},
afterTask: function() {
this.timeTaken = new Date() - startTime;
}
});
myZone.run(function(){
this.task1();
setTimeout(this.task1, 2000);
this.task1();
}.bind(this));
}
}
The text was updated successfully, but these errors were encountered:
I'm trying to implement simple
zone.afterTask
andbeforeTask
hooks but though code ain't throwing any error , those methods are never getting called.I searched Zone repo in github , and couldn't find any reference to these methods in the source code apart from the ones that's used in the example.
counting example
does use afterTask and beforeTask but I've set a debugger and saw those methods are never getting called in their example as well .It looks like these methods have been deprecated , If not kindly let me know what I'm doing wrong.
Here's my code -
The text was updated successfully, but these errors were encountered: