-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (30 loc) · 950 Bytes
/
index.js
File metadata and controls
37 lines (30 loc) · 950 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
34
35
36
// if ('serviceWorker' in navigator) {
// navigator.serviceWorker.register('./service-worker.js');
// navigator.serviceWorker.addEventListener('message', (event) => {
// if (event.data && event.data.type === 'CACHE_UPDATED') {
// // Reload the page when the cache is updated
// window.location.reload(true);
// }
// });
// }
function displayContent() {
const page = document.querySelector('main');
const currentURL = (window.location.href).split('#')[1];
// console.log(currentURL);
switch (currentURL) {
case 'about':
console.log('about');
AboutPage(page);
break;
case 'contact':
ContactPage(page);
break;
case 'test':
TestPage(page);
break;
default:
HomePage(page);
}
}
displayContent();
window.addEventListener('hashchange', displayContent);