angular2: How to use observables to debounce window:resize : <p>so i am trying to figure out a way to debouce window:resize events using observables, so some kind of function would be called only after user stoped resizing window or some time has passed without size change (say 1sec).</p>

<p><a href="https://plnkr.co/edit/cGA97v08rpc7lAgitCOd" rel="noreferrer">https://plnkr.co/edit/cGA97v08rpc7lAgitCOd</a></p>

<pre><code>import {Component} from '@angular/core'

@Component({
  selector: 'my-app',
  providers: [],
  template: `
    &lt;div (window:resize)="doSmth($event)"&gt;
      &lt;h2&gt;Resize window to get number: {{size}}&lt;/h2&gt;

    &lt;/div&gt;
  `,
  directives: []
})
export class App {
  size: number;
  constructor() {
  }

  doSmth(e: Event) {
    this.size = e.target.innerWidth;
  }
}
</code></pre>

<p>is just a simple sample that uses window:resize and shows that it reacts instantly (use "Launch preview in separate window").</p>
