🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

really-tiny-router

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

really-tiny-router

A really tiny HTML5 router

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Really Tiny Router

A zero-whistles, bare metal HTML5 router that supports push state. When you need to just route your stuff somewhere and be done with it.

Usage

The basic routing looks kind of like that:

import { route } from "really-tiny-router";

route({
  "/users":              callback1,
  "/users/:id":          callback2,
  "/posts/:year/:month": callback3,
  "*whatevs":            callback4
});

NOTE: this call kicks in the routing right away

There is also couple of methods to work with the HTML5 history that tap into the configured routes:

import { push, replace } from "really-tiny-router";

// pushing a new state into the history
push("http://nikolay.rocks/blah"[, title]);

// replacing the current state in the history
replace("/something/else"[, title]);

All code in this repository is released under the terms of the MIT license.

Copyright (C) 2015-2016 Nikolay Nemshilov

Keywords

router

FAQs

Package last updated on 06 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts