Skip to content

Commit

Permalink
Added routing basics
Browse files Browse the repository at this point in the history
  • Loading branch information
akyoto committed Jun 12, 2018
1 parent 1af9005 commit 9e10f0c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions elements/app-view/app-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ export default class AppView extends HTMLElement {
State.user = new User("guest")
State.words = new Map<string, Word>()

// Main menu
this.createMainMenu()
// Decide what to do based on the route
this.route(window.location.pathname)

// Loading finished
this.loading = false
}

route(uri: string) {
if(!uri || uri === "/") {
// Main menu
this.createMainMenu()
}
}

createMainMenu() {
this.mainMenu = document.createElement("main-menu") as MainMenu
this.appendChild(this.mainMenu)
Expand Down

0 comments on commit 9e10f0c

Please sign in to comment.