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>
  • 相关阅读:
    Promise/Deferred
    理解RESTful架构
    XSS跨站脚本攻击
    crsf 跨站请求伪造
    街头生意
    什么是开光
    影响力
    linux上安装rar解压软件
    sip协议音视频性能测试
    解决关键SSL安全问题和漏洞
  • 原文地址:https://www.cnblogs.com/dingyunfeng/p/11164053.html
Copyright © 2011-2022 走看看