-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRouter.js
36 lines (34 loc) · 840 Bytes
/
Router.js
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
'use strict';
class Router{
constructor(){
this.page = null
}
buildDOM(url, parent, artist){
switch (url) {
case '/':
this.generateLandingPage(parent);
break;
case '/artistslist':
this.generateListArtistsPage(parent, artist);
break;
case '/viewartist':
this.generateViewArtistPage(parent, artist);
break;
default:
this.generateLandingPage(parent);
}
}
generateLandingPage(parent){
this.page = new LandingPage(parent);
this.page.generate();
}
generateListArtistsPage(parent, artist){
this.page = new ListOfArtists(parent, artist);
this.page.generate();
}
generateViewArtistPage(parent, artist){
this.page = new ArtistDetail(parent, artist);
this.page.generate();
}
}
const routerInstance = new Router();