0.0.1 • Published 5 months ago

navigation-router v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

navigation-router

Client-side routing using the Navigation API.

This module relies on the experimental Navigation API and URLPattern API.

These APIs are not available in all browsers! Yet!

Check browser support:

Usage

import NavigationRouter from 'navigation-router'

const router = new NavigationRouter()

router.add('/', async (route) => {
    console.log('handling route', route)
})

router.add('/posts/:id', async (route) => {
    console.log('handling route', route.params.id, route)
})

router.on('change', (event) => {
    console.log('route changed', event.detail)
})

router.on('404', (event) => {
    console.log('404', event.detail)
})
0.0.1

5 months ago

0.0.0

5 months ago