Skip to content Skip to sidebar Skip to footer

Using Timeouts With Toastr

Most of the toastr demos are client side only. If I get a server push of this json data [ {'msg': 'Mortgage bill paid', 't': 'i'} {'msg': 'Account Balance below $3000',

Solution 1:

This is the exact thing you need I guess

setTimeout((function() {
   toastr.info('MESSAGE TITLE', 'message content', {options});
}), delay);

toastr.options = {
  "closeButton": true,
  "debug": false,
  "newestOnTop": false,
  "progressBar": false,
  "positionClass": "toast-top-center",
  "preventDuplicates": false,
  "onclick": null,
  "showDuration": "300",
  "hideDuration": "1000",
  "timeOut": "5000",
  "extendedTimeOut": "1000",
  "showEasing": "swing",
  "hideEasing": "linear",
  "showMethod": "fadeIn",
  "hideMethod": "fadeOut"
}

Solution 2:

You could loop through the array and call toastr['info'] or toastr['warning'] (map the i to info, for example). FOr delays, you could use a timeout and delay the messages by 2000 ms for each.

timeout(toastr['info']('your message'), 2000);

Post a Comment for "Using Timeouts With Toastr"