History++

A lightweight, UI-agnostic SPA navigation engine built on top of the native History API.

Features

Lifecycle-based Routing

Direction-aware route lifecycle hooks including onArrive, onMeet, onReturn, and onComeback.

Dynamic Params

Supports expressive route patterns such as /user/:id.

Middleware

Execute middleware pipelines before lifecycle execution.

History + Hash Mode

Works with both native history navigation and hash-based routing.

Navigation Guards

Block route transitions safely using canLeave().

Trie Matcher

Optional trie-based route matcher for large route trees.

Quick Start

historypp.config({
  mode: "history"
});

historypp.router("/", {
  onMeet() {
    console.log("Home");
  }
});

historypp.navigateReplace(location.pathname);