mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
⚡ Perf: clear site run time interva when document hidden
This commit is contained in:
@@ -286,11 +286,13 @@
|
||||
|
||||
{{- /* Site time Initialization */ -}}
|
||||
{{- if eq .Site.Params.ibruce.enable true | and .Site.Params.ibruce.siteTime -}}
|
||||
if (!document.hidden) {
|
||||
var siteTime = setInterval("createTime()", 500);
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
if (document.hidden) {
|
||||
return clearInterval(siteTime);
|
||||
}
|
||||
var siteTime = setInterval("createTime()", 500);
|
||||
} else {
|
||||
clearInterval(siteTime);
|
||||
}
|
||||
});
|
||||
{{- end -}}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
Reference in New Issue
Block a user