add reload shortcode
reload site after n secounds
This commit is contained in:
parent
0e4a1a46a0
commit
7f5457f380
13
layouts/shortcodes/reload.html
Normal file
13
layouts/shortcodes/reload.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{{ $seconds := .Get 0 }}
|
||||||
|
{{ $ms := ( printf "%s%s" $seconds "000" )}}
|
||||||
|
<script>
|
||||||
|
function Sleep(milliseconds) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, milliseconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function reload(){
|
||||||
|
await Sleep({{ $ms }});
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
reload();
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user