src/toastify.js
function(options) {
      // Verifying and validating the input object
      if (!options) {
        options = {};
      }

      // Creating the options object
      this.options = {};

      // Validating the options
      this.options.text = options.text || "Hi there!"; // Display message
      this.options.duration = options.duration || 3000; // Display duration
      this.options.selector = options.selector; // Parent selector
      this.options.callback = options.callback || function() {}; // Callback after display
      this.options.destination = options.destination; // On-click destination
      this.options.newWindow = options.newWindow || false; // Open destination in new window
      this.options.close = options.close || false; // Show toast close icon
      this.options.gravity = options.gravity == "bottom" ? "toastify-bottom" : "toastify-top"; // toast position - top or bottom
      this.options.positionLeft = options.positionLeft || false; // toast position - left or right
      this.options.backgroundColor = options.backgroundColor; // toast background color
      this.options.avatar = options.avatar || ""; // toast position - left or right
      this.options.className = options.className || ""; // additional class names for the toast

      // Returning the current object for chaining functions
      return this;
    }
function(options) {
      // Verifying and validating the input object
      if (!options) {
        options = {};
      }

      // Creating the options object
      this.options = {};

      // Validating the options
      this.options.text = options.text || "Hi there!"; // Display message
      this.options.duration = options.duration || 3000; // Display duration
      this.options.selector = options.selector; // Parent selector
      this.options.callback = options.callback || function() {}; // Callback after display
      this.options.destination = options.destination; // On-click destination
      this.options.newWindow = options.newWindow || false; // Open destination in new window
      this.options.close = options.close || false; // Show toast close icon
      this.options.gravity = options.gravity == "bottom" ? "toastify-bottom" : "toastify-top"; // toast position - top or bottom
      this.options.positionLeft = options.positionLeft || false; // toast position - left or right
      this.options.backgroundColor = options.backgroundColor; // toast background color
      this.options.avatar = options.avatar || ""; // toast position - left or right
      this.options.className = options.className || ""; // additional class names for the toast

      // Returning the current object for chaining functions
      return this;
    }
function ( options ) { // Verifying and validating the input object if ( ! options ) { options = { } ; } // Creating the options object this . options = { } ; // Validating the options this . options . text = options . text || "Hi there!" ; // Display message this . options . duration = options . duration || 3000 ; // Display duration this . options . selector = options . selector ; // Parent selector this . options . callback = options . callback || function ( ) { } ; // Callback after display this . options . destination = options . destination ; // On-click destination this . options . newWindow = options . newWindow || false ; // Open destination in new window this . options . close = options . close || false ; // Show toast close icon this . options . gravity = options . gravity == "bottom" ? "toastify-bottom" : "toastify-top" ; // toast position - top or bottom this . options . positionLeft = options . positionLeft || false ; // toast position - left or right this . options . backgroundColor = options . backgroundColor ; // toast background color this . options . avatar = options . avatar || "" ; // toast position - left or right this . options . className = options . className || "" ; // additional class names for the toast // Returning the current object for chaining functions return this ; }
Initializing the object with required parameters
Initializing the object with required parameters