Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Latest commit

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Unchained UI

Router

NPM VersionNPM Downloads

Declarative router

Usage

importRouterfrom'uc-router'constrouter=newRouter((name,params)=>console.log(name,params))router.add('post','/posts(/:id)').add('index','/');router.start();

Methods

add(name, route)

Adds new route with the name.

delete(name)

Deletes a route with the name.

start()

Starts the router and checks the current URL

go(url[, state])

Navigates to url. If url is the same as current does nothing. However, if you add ! symbol to the beginning of the url forces the router to it check again.

replace(url[, state])

Replaces the current state with url and state.

back([path])

Goes back in history if previous state exists. Else navigates to the path.

remove()

Removes the router

License MIT

© velocityzen

About

Declarative router

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages