public/scripts/main.js
/// Saves a new message in the Realtime Database.
Saves a new message in the Realtime Database.
Saves a new message in the Realtime Database .
function saveMessage(messageText) {
  return firebase.database().ref('/messages/').push({
    name: getUserName(),
    text: messageText,
    profilePicUrl: getProfilePicUrl()
  }).catch(function(error) {
    console.error('Error writing new message to Realtime Database:', error);
  });
}
function saveMessage ( messageText ) { return firebase . database ( ) . ref ( '/messages/' ) . push ( { name : getUserName ( ) , text : messageText , profilePicUrl : getProfilePicUrl ( ) } ) . catch ( function ( error ) { console . error ( 'Error writing new message to Realtime Database:' , error ) ; } ) ; }
Saves a new message in the Realtime Database.
Saves a new message in the Realtime Database .
// Adds a new message entry to the Realtime Database.