hash-brown-router
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -8,4 +8,2 @@ var pathToRegexp = require('path-to-regexp-with-reversible-keys') | ||
function noop() {} | ||
module.exports = function Router(opts, hashLocation) { | ||
@@ -12,0 +10,0 @@ var emitter = new EventEmitter() |
{ | ||
"name": "hash-brown-router", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A client-side router that only cares about the bits after the #", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,2 +12,25 @@ # hash-brown-router | ||
# Example | ||
```js | ||
var router = require('hash-brown-router')() | ||
var mainElement = document.getElementById('main') | ||
router.add('/', function() { | ||
mainElement.innerHTML = 'Thank you for visiting my site! This is the home screen.' | ||
}) | ||
router.add('/blog-post/:blogPostName', function (parameters) { | ||
mainElement.innerHTML = getHtmlForBlogPost(parameters.blogPostName) | ||
}) | ||
router.on('not found', function (path, querystringParameters) { | ||
alert('Couldn\'t find that page, sorry! Redirecting you to the home screen.') | ||
router.location.replace('/') | ||
}) | ||
router.evaluateCurrent('/') | ||
``` | ||
# API | ||
@@ -14,0 +37,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20548
115
442