xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

页面超过 10 分钟没有任何操作

页面超过 10 分钟没有任何操作

<!DOCTYPE html>
<html lang="zh-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="author" content="xgqfrms">
    <meta name="generator" content="VS code">
    <title>all web page events all in one</title>
    <style>
      pre#app {
        color: #0f0;
        background: #000;
        padding: 30px;
      }
    </style>
</head>
<body>
    <header>
        <h1>test</h1>
    </header>
    <main>
        <section>
            <pre id="app"></pre>
        </section>
        <article></article>
    <main>
    <footer>
        <p>copyriht&copy; xgqfrms 2021</p>
    </footer>
    <script src="./userEventsCheeker.js"></script>
    <script>
      // load
      const app = document.querySelector(`#app`);
      let timerId = null;
      // 1000 * 60 * 10
      const callback = (obj = {}, timer = 1000 * 60) => {
        console.log('keydown e', JSON.stringify(obj, null, 4));
        if([Object.keys(obj)].length) {
          app.innerHTML = JSON.stringify(obj, null, 4);
          if(timerId) {
            clearTimeout(timerId);
          }
        }
        // localStorage Map pathname ? false : true
        timerId = setTimeout(() => {
            console.log('该页面超过 1 分钟没有任何操作了');
            alert('该页面超过 1 分钟没有任何操作了');
        }, timer);
      }
      const test = new UserEventsChecker('app', callback);
      // test();
    </script>
</body>
</html>

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(74)  评论(2编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2020-03-29 ROI
2020-03-29 React & Calendar
2020-03-29 taro & Block
2020-03-29 taro swiper & scroll tabs
2016-03-29 读写 LED 作业 台灯的 频闪研究 2 评测&对比!
点击右上角即可分享
微信分享提示