Javascript 对toastr使用超时

Javascript 对toastr使用超时,javascript,timeout,toastr,Javascript,Timeout,Toastr,大多数toastr演示仅限于客户端 如果我得到这个json数据的服务器推送 [ {"msg": "Mortgage bill paid", "t": "i"} {"msg": "Account Balance below $3000", "t": "i"} {"msg": "Received Car payment request", "t": "w"} ] 如何使用toastr通读项目并发布1和2的“信息”,3的“警告”,右下角是可以的。我想在两次祝酒之

大多数toastr演示仅限于客户端

如果我得到这个json数据的服务器推送

   [
    {"msg": "Mortgage bill paid", "t": "i"}
    {"msg": "Account Balance below $3000", "t": "i"}
    {"msg": "Received Car payment request", "t": "w"}
    ]
如何使用toastr通读项目并发布1和2的“信息”,3的“警告”,右下角是可以的。我想在两次祝酒之间延迟2000次,这样祝酒就不会同时来了


你能给我举一个类似的例子吗。我能做到这一点。从某种意义上讲,定时消息传递。

您可以在数组中循环调用toastr['info']或toastr['warning'](例如,将i映射到info)。对于延迟,您可以使用超时,并将消息延迟2000毫秒

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

您可以在数组中循环调用toastr['info']或toastr['warning'](例如,将i映射到info)。对于延迟,您可以使用超时,并将消息延迟2000毫秒

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

我想这正是你需要的东西

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"
}

我想这正是你需要的东西

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"
}
我解决了它…它的setTimeout(…)…延迟权到JSON表。我解决了它…它的setTimeout(…)…延迟权到JSON表。