Javascript Firebase RealTime Database Completion Block

I am trying to understand firebase-realtime-database. I am able to fetch the data, but I do not know how to add a completion block. I mean, is there a function to check when my data fetch query is completed?

function getData() { 
  firebase.database().ref('sections').once('value', function(names) {
     //got the data
  });
  //Completion block or a method to call processData() after I get all the sections
}

function processData() {
 //call this function after you get all the sections
}

Thank you very much!