Skip to content

Commit 3099553

Browse files
authored
Should fix when the device is in sleep mode
Hello. I have a problem when my laptop is in sleep, after waking up I see an error connecting to the Internet. I found out that when this condition is met, my page starts to reload, but since the laptop is in sleep mode, then it does not have access to the Internet, respectively. I found a solution to this problem in correcting this part of the code When I added setTimeout I stopped getting infinite page reload and further connection error. Now my page reloads when my laptop wakes up.
1 parent 9023b3b commit 3099553

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

resources/views/script.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
if ({{ $ageCheckInterval }} > 0) {
2828
setInterval(function () {
2929
if (new Date() - lastCheck >= {{ $ageCheckInterval + $ageThreshold }}) {
30-
location.reload(true);
30+
setTimeout(function () {
31+
location.reload(true);
32+
}, Math.max(0, {{ $ageCheckInterval }} - 500) )
3133
}
3234
}, {{ $ageCheckInterval }});
3335
}

0 commit comments

Comments
 (0)