Skip to content

Commit

Permalink
add vanilla js test
Browse files Browse the repository at this point in the history
  • Loading branch information
altrusl committed Dec 3, 2023
1 parent a15f803 commit d2617ac
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions public/vanilla-js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="SPA Google SEO test" />
<title>Title:</title>
</head>
<body>
<p>Low snowcat catches a flu</p>
</body>
<script>
function update(key, str) {
console.log("Adding: ", key);
document.querySelector("title").innerHTML += key + " & ";
// here'll be strings of strange unique phrases (SUP!)
document.body.appendChild(document.createElement("p")).innerHTML =
key + ": " + str;
}

update("inline", "Glass dwarf climbs the stairways to clouds");

addEventListener("DOMContentLoaded", (event) => {
update("onload", "Angry wonderbird killed and ate a hippo");
fetch("https://jsonplaceholder.typicode.com/todos/1")
.then((response) => response.json())
.then((json) => {
update(
"onload-fetch",
json.title + " --- Serve Godzilla with nightstands and artichokes"
);
});
});

fetch("https://jsonplaceholder.typicode.com/todos/2")
.then((response) => response.json())
.then((json) => {
update(
"fetch",
json.title + " --- A bald turtle banging a hammer on an anvil."
);
});
</script>
</html>

0 comments on commit d2617ac

Please sign in to comment.