1234567891011121314151617181920212223242526272829303132333435363738 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <link rel="shortcut icon" type="image/x-icon" href="/src/assets/images/logo.png">
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title><%- title %></title>
- <script>
- window.process = {
- cwd() { return '' }
- }
- // 浏览器关闭执行的是 beforeunload , unload 这两个事件
- // 而浏览器刷新执行的是 beforeunload, unload, load 三个事件
- // 关闭浏览器,两个事件执行间隔事件会少于5ms,刷新页面时间会长,不同页面经测试所需时间8~100ms之间不等
- window.addEventListener('beforeunload', (event) => {
- // event.preventDefault();
- // event.returnValue = '';
- // window.beforeUnloadTime = new Date().getTime();
- });
- window.addEventListener('unload', function (event) {
- // const gapTime = new Date().getTime() - window.beforeUnloadTime;
- // if (gapTime <= 5) {
- // window.trace && window.trace.stop('SZJC-' + Date.now())
- // console.log('>>>>>>结束录制');
- // } else {
- // console.log('>>>>>>刷新,继续录制');
- // }
- });
- </script>
- </head>
- <body>
- <div id="app"></div>
- <script type="module" src="/src/main.ts"></script>
- </body>
- </html>
|