Skip to content

mench/hash-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hash-router

Javascript and Typescript hash routing library.

Installation

$ npm install --save browser-hash-router

###Basic Usage

import {Router} from 'browser-hash-router';

//example.com/#users/123456
Router.route('users/:id',id=>{
    console.log(id);
})
//example.com/#users
Router.route('users',()=>{
})
//example.com/#users/foo/bar
Router.route('users/*',()=>{
})
//example.com/#all/paths
Router.route('*',()=>{

});
//start navigation
Router.start();
//navigating to example.com#users/15
Router.navigate('users/15');