-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
33 lines (28 loc) · 786 Bytes
/
app.js
File metadata and controls
33 lines (28 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
window.addEventListener('load', async () => {
if ('serviceWorker' in navigator) {
try {
const reg = await navigator.serviceWorker.register('sw.js')
console.log('Service worker register success', reg)
} catch (e) {
console.log('Service worker register fail')
}
}
// await loadPosts()
})
async function loadPosts() {
let fetch1 = new Fetch("http://localhost:8080/text.txt").request("text");
// const container = document.querySelector('#posts')
// container.innerHTML = data.map(toCard).join('\n')
}
// function toCard(post) {
// return `
// <div class="card">
// <div class="card-title">
// ${post.title}
// </div>
// <div class="card-body">
// ${post.body}
// </div>
// </div>
// `
// }