title: Firebase: How to stop listening to snapshot
body: <p>I have a javascript application that uses the onSnapshot listener to listen to changes in my firebase collection. The docs tell me to unsubscribe when I am no longer in need of the listener. In React I would do this in <code>componentWillUnmount()</code> but if I've set up the listener in a vanilla class (not React), how would I unsubscribe in this situation?</p>
  
  <p>How I'm implementing it...</p>
  
  <pre><code>class MyComponent extends React.Component {
    constructor() {
      super();
      this.presenter = new MyPresenter();
    }
    ...rest of component
  
  class MyPresenter {
      constructor() {
        const listener = db.collection("cities")
          .onSnapshot(function () {});
      }
  }
  </code></pre>