Skip to content

Commit 3b2fb60

Browse files
committed
close mobile reload
1 parent a9fdd31 commit 3b2fb60

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

globals/static/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@ <h1>RSS Reader</h1>
180180
}
181181
socket.onclose = event => {
182182
console.log("WebSocket closed. Reconnecting...");
183-
setInterval(reloadHtml, 3000);
183+
// 使用媒体查询判断设备类型
184+
const isMobile = window.matchMedia('(max-width: 767px)').matches;
185+
if (!isMobile) {
186+
setInterval(reloadHtml, 3000);
187+
}
184188
};
185189
// Send heartbeat message every 120 seconds
186190
const sendHeartbeat = () => {

0 commit comments

Comments
 (0)