title: Firebase on() does not return anything
body: <p>I have this piece of code using on() to get data from Firebase, inside on() I create object which I want to send out of function for future use - using return, but it seems it doesn't return anything.
  So question is how can I make it right?</p>
  
  <pre><code>postsRef.on('value', function(snapshot) {
   if (snapshot.val() === null) {
    var allPosts = false,
    numberOfPosts = 0;
   }
   else {
    var allPosts = snapshot.val(),
    numberOfPosts = Object.size(allPosts);
   }
   var postsData = {
    content: allPosts,
    count: numberOfPosts
   };
   return postsData;
  });
  </code></pre>