[英]Using timeouts with 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 ms。
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"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.