title: RxJS - Wait until 5 events to occur before continuing
body: <p>I have a simple RxJS5 observable like so:</p>
  
  <pre><code>function foo(){
  
   return Rx.Observable.create(obs =&gt; {
            obs.next();
     });
  
  }
  </code></pre>
  
  <p>the observable is created like so:</p>
  
  <pre><code>const x = foo();
  
  function bar(){
  
       return someObs()
         .flatMap(() =&gt; x.wait(5))  // wait for x to fire 5 times
         .map(v =&gt; ({z:v}));
  
  }
  </code></pre>
  
  <p>What I want to do is wait for 5 events in the x observable to fire, before continuing.</p>
  
  <p>I don't think the <code>take</code> operator is what I want, so I just called the operator "<code>wait</code>"</p>
  
  <p>How can I do that with RxJS5?</p>