Created
February 11, 2015 23:25
-
-
Save isaacrankin/bedf45b3be2ac6ac5348 to your computer and use it in GitHub Desktop.
The simplest JS router
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var base = '/'; | |
switch (location.pathname){ | |
case base + 'contact': | |
console.log('you are viewing the contact page'); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment