zoukankan      html  css  js  c++  java
  • python的轮询timer 和js的轮询setInterval

    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>
  • 相关阅读:
    MySQL Create table as / Create table like
    Oracle CAST() 函数 数据类型的转换
    day 12
    day 11
    day 10
    day 9
    day 8
    day 7
    day 6
    day 5
  • 原文地址:https://www.cnblogs.com/dingyunfeng/p/11164053.html
Copyright © 2011-2022 走看看