python的轮询timer 和js的轮询setInterval

mac2022-06-30  29

python的轮询Timer:                                                                        

import threading def say_hello(arg=''): timer_online = threading.Timer(1, say_hello,('world',)) timer_online.start() print('hello ',arg) say_hello()

 


js中的轮询setInterval:                                                                

<script type="text/javascript"> var timer1 = 1; window.onload = function () { function read_data() { location.href = 'http://127.0.0.1:8000'; }; timer1 = window.setInterval(read_data,2*1000); }; $('#begin_btn').click(function () { location.href = 'http://127.0.0.1:8000'; }); $('#cancle_btn').click(function () { window.clearInterval(timer1); }) </script>

 

转载于:https://www.cnblogs.com/dingyunfeng/p/11164053.html

最新回复(0)