Skip to content

Instantly share code, notes, and snippets.

@tiagorangel2011
Created February 24, 2024 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiagorangel2011/7281f3980503beea660c45bc01d5cae9 to your computer and use it in GitHub Desktop.
Save tiagorangel2011/7281f3980503beea660c45bc01d5cae9 to your computer and use it in GitHub Desktop.
Simple hot reload for HTML
setTimeout(async function () {
let o = await (await fetch(location.href)).text();
var i = setInterval(async function () {
var n = await (await fetch(location.href)).text();
if (!(o == n)) { location.reload(); clearInterval(i) }
}, 500)
}, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment