title: Check if there are scheduled tasks with Angular2 and Zone.js
body: <p>Is there any way to check if there are scheduled task using Angular2 and Zone.js?</p>
  
  <p>Let's say I have this component</p>
  
  <pre><code>import...
  
  @Component({...})
  export class MyComponent {
  
    public myMethod() {
      console.log('enter my method');
      setTimeout(function() { console.log('task1'); }, 1000);
      setTimeout(function() { console.log('task2'); }, 1500);
    }
  
  }
  </code></pre>
  
  <p>and I want be notified when both <code>task1</code> and <code>task2</code> are completed.</p>
  
  <p>In my app component I'm subscribed to <code>onUnstable</code> and <code>onStable</code> events in this way:</p>
  
  <pre><code>@Component({
    selector: 'app',
    directives: [MyComponent],
    template: `&lt;mycmp&gt;&lt;/mycmp&gt;`
  })
  export class AppComponent {
  
    constructor(private zone:NgZone) {
      console.log('start app component constructor');
  
      zone.onUnstable.subscribe(function(args){
        console.log('enter unstable');
      });
  
      zone.onStable.subscribe(function(args){
        console.log('enter stable');
      });
    }
  }
  </code></pre>
  
  <p>So, when I call <code>myMethod()</code> what I expect is this sequence of logs:</p>
  
  <pre><code>enter unstable
  enter my method
  task1
  task2
  enter stable
  </code></pre>
  
  <p>but I get this:</p>
  
  <pre><code>enter unstable
  enter my method
  enter stable
  enter unstable
  task1
  enter stable
  enter unstable
  task2
  enter stable
  </code></pre>