完成后重新启动功能的定时器 [英] Timer to restart function when completed

查看:51
本文介绍了完成后重新启动功能的定时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前遇到了计时器问题.

I'm currently stuck on a problem with a timer.

我有一个函数,它每 x 秒由一个计时器启动.现在,在不同条件下,函数执行有时可能需要更长的时间.所以我希望计时器只有在完成功能后才重新运行.我怎样才能做到这一点?

I've got a function that is started by a timer every x seconds. Now the function execution can sometimes take longer under different conditions. So I want the timer to rerun only when it has completed the function. How can I achieve this?

推荐答案

就在它退出之前,您的函数可能会触发一个事件.该事件将被另一个函数捕获,该函数将启动计时器.

Right before it exits, your function could trigger an event. The event will be caught by another function, which will start the timer.

这篇关于完成后重新启动功能的定时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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