title: Firebase onDisconnect().set() with function
body: <p>I have to do some stuff when Firebase disconnects and also call a <code>set()</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>this.state.ref.child('users/' + uid + '/online').onDisconnect().set(false, function(){
  
            // ... do some stuff ...
  
          })
  </code></pre>
  
  <p>But it seems like the function inside <code>set()</code> calls regardless whether of connection is disconnected.</p>
  
  <p>How to call a function in <code>onDisconnect().set()</code> properly?</p>