直播源码开发,js监听在当前页面停留太长时间

直播源码开发,js监听在当前页面停留太长时间

 使用

 


// 引用方法
<script src="./longTimeStopScreen.js"></script>
<script>
  window.onload = () => {
    // 定义倒计时的时长
    const time = 10;
    longTimestopScreen(true, time, fn);
 
    // 执行函数(回调函数)
    function fn(params) {
      if (window.confirm('你已经停留很久了,是否重新登录!')) {
        // 点击了确认 -- 清除定时器
        longTimestopScreen(false);
        // 执行其他操作逻辑
        console.log('确认', window.LTimer);
      } else {
        // 点击了取消 -- 重置定时器重新倒计时
        // stopMove(true, time, fn);
        console.log('取消', window.LTimer);
      }
    }
  };
</script>

 以上就是 直播源码开发,js监听在当前页面停留太长时间,更多内容欢迎关注之后的文章

 

posted @ 2023-05-23 14:05  云豹科技-苏凌霄  阅读(5)  评论(0编辑  收藏  举报