static/js/interface.js
/**
 * Display a message in toast.
 * @function toastMsg
 * @param {string} msg - message to display
 * @param {Object} stat - status object
 * @param {number} duration - milliseconds to keep toast visible; if omitted,
 * the default time is 1 sec; set 0 to keep it visible for ever
 * @param {boolean} loading - display loading dots
 * @param {boolean} toclose - display a close button
 */
Display a message in toast.
Display a message in toast .
function toastMsg(msg, stat, duration, loading, toclose) {
  if (duration === undefined) duration = 2000;
  const toast = byId('toast');
  toast.firstElementChild.innerHTML = msg;
  byId('toast-dots').classList.toggle('hidden', !loading);
  byId('toast-close-btn').classList.toggle('hidden', !toclose);
  toast.classList.remove('hidden');
  if (duration) {
    clearTimeout(stat.toasting);
    stat.toasting = setTimeout(function () {
      toast.classList.add('hidden');
      toast.firstElementChild.innerHTML = '';
    }, duration);
  }
}
function toastMsg ( msg , stat , duration , loading , toclose ) { if ( duration === undefined ) duration = 2000 ; const toast = byId ( 'toast' ) ; toast . firstElementChild . innerHTML = msg ; byId ( 'toast-dots' ) . classList . toggle ( 'hidden' , ! loading ) ; byId ( 'toast-close-btn' ) . classList . toggle ( 'hidden' , ! toclose ) ; toast . classList . remove ( 'hidden' ) ; if ( duration ) { clearTimeout ( stat . toasting ) ; stat . toasting = setTimeout ( function ( ) { toast . classList . add ( 'hidden' ) ; toast . firstElementChild . innerHTML = '' ; } , duration ) ; } }
Display a message in toast.
Display a message in toast .