Skip to content

Commit

Permalink
swap off await cause why not
Browse files Browse the repository at this point in the history
wip
  • Loading branch information
elasticspoon committed Jan 22, 2024
1 parent 3bc8932 commit 0312205
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions assets/reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ function reload() {
});
}

async function pollServer() {
try {
console.log("Polling server...");
let response = await fetch("http://localhost:12345/");
reload();
pollServer();
} catch (err) {
console.log(err);
console.log("Server not ready. Reload the page with the server running.");
}
function pollServer() {
fetch("http://localhost:12345/")
.then(() => {
reload();
pollServer();
})
.catch((err) => {
console.log(err);
console.log("Server not ready. Reload the page with the server running.");
});
}

pollServer();
1 change: 1 addition & 0 deletions lib/local-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def watch_files
@thread = Thread.new(filewatcher) do |fw|
fw.watch do |change|
puts "Change detected: #{change}" if opts.verbose
# TODO: change this to use exposed methods
generator.send(:write_html)
@needs_reload = true
end
Expand Down

0 comments on commit 0312205

Please sign in to comment.