title: How to get previous value of RxJS Subject?
body: <p>I my project I need to compare my paginator's <code>pageSize</code> value (items per page) with the previous value and if the new one is higher, then I need to load datas from storage. But if it's not higher I don't want to do anything.</p>
  <p>For example in this code:</p>
  <pre class="lang-js prettyprint-override"><code>export class MyComponent {
    paginatorPageSize: BehaviorSubject&lt;number&gt; = new BehaviorSubject&lt;number&gt;(10);
    // ...
  
    savePageSettings() {
      this.pageService.save().pipe(
        map((result: any) =&gt; {
          // ...
        }),
        tap(() =&gt; this.anyCode.here()),
        switchMap((result: any) =&gt; {
          // ...
        }),
        switchMap(() =&gt; {
          const previousPageSize = ??? // &lt;--- here how can I get the prevoius value of paginatorPageSize?
  
          if (previousPageSize &gt;= this.paginatorPageSize.value) {
            return this.pageService.getAll();
          }
  
          return of(null)
        })
      ).subscribe();
    }
  }
  </code></pre>
  <p>Is there any way to get the previous emitted value of a RxJS Subject / BehavioSubject or any kind of subjects?</p>