在Toastr中使用超时 [英] Using timeouts with toastr

查看:182
本文介绍了在Toastr中使用超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数烤面包机演示仅在客户端进行.

Most of the toastr demos are client side only.

如果我收到此json数据的服务器推送

If I get a server push of this json data

   [
    {"msg": "Mortgage bill paid", "t": "i"}
    {"msg": "Account Balance below $3000", "t": "i"}
    {"msg": "Received Car payment request", "t": "w"}
    ]

我如何使用烤面包机通读项目并为1和2发布信息",为3发布警告",右下角还可以.我想在吐司之间延迟2000年,以使吐司不会同时出现.

How would I use toastr read through items and publish 'info' for 1 and 2, "warning" for 3, lower right is ok. I would like a delay of 2000 between toasts so the toast dont come at the same time.

您能指出一些类似的例子吗?敬酒可以做到这一点.从某种意义上说,定时消息传递.

Can you point me to example that show something similar. Can toastr do this. Timed messaging in a sense.

推荐答案

您可以遍历数组并调用toastr ['info']或toastr ['warning'](例如,将i映射到info).对于延迟,您可以使用超时并将每条消息延迟2000毫秒.

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);

这篇关于在Toastr中使用超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆