0.0.4 • Published 2 years ago

simple-ts-router v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

simple ts router

~1.5kb gzipped

npm

import { Router } from "simple-ts-router";

const router = new Router();
const title = <HTMLHeadingElement>document.querySelector("#title");

router
  .add("/blog/:id/post/:postid", ({ id, postid }) => {
    title.innerText = `blog ${id} : ${postid}`;
  })
  .add("/", () => {
    title.innerText = "home";
  })
  .add("_404", () => {
    title.innerHTML = "404";
  })
  .check();

web

import { Router } from "https://cdn.skypack.dev/simple-ts-router?min";

const router = new Router();
const title = <HTMLHeadingElement>document.querySelector("#title");

router
  .add("/blog/:id/post/:postid", ({ id, postid }) => {
    title.innerText = `blog ${id} : ${postid}`;
  })
  .add("/", () => {
    title.innerText = "home";
  })
  .add("_404", () => {
    title.innerHTML = "404";
  })
  .check();
0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago