javascript 轮询
Polling with JavaScript is one of those ugly but important functions within advanced front-end user experience and testing practices. Sometimes there isn't the event you can hook into to signify that a given task is complete, so you need to get your hands dirty and simply poll for it. Polling with JavaScript isn't difficult but it's not easy either. Let me show you a few implementations of JavaScript polling that you can add to your toolbox!
使用JavaScript进行轮询是高级前端用户体验和测试实践中那些难看但重要的功能之一。 有时没有事件可以挂起,以表明给定任务已完成,因此您需要动手操作并简单地对其进行轮询。 用JavaScript轮询并不困难,但也不容易。 让我向您展示一些可以添加到工具箱中JavaScript轮询的实现!
有诺言 (With Promises)
Since the Promise API is implemented almost all browsers today, here's a polling implementation using t