Guestbook.prototype.saveMessage = function()

in text-moderation/public/main.js [56:73]


Guestbook.prototype.saveMessage = function(e) {
  e.preventDefault();
  if (this.messageInput.value && this.nameInput.value) {
    Guestbook.fbMessagesRef.push({
      name: this.nameInput.value,
      text: this.messageInput.value,
      timestamp: firebase.database.ServerValue.TIMESTAMP
    }, function (error) {
      if (error) {
        console.log(error);
      } else {
        Guestbook.resetMaterialTextfield(this.messageInput);
        Guestbook.resetMaterialTextfield(this.nameInput);
        this.toggleButton();
      }
    }.bind(this));
  }
};