gluonjs-router

0.0.1 • Public • Published

gluon-router

A simple router exposed as an ES6 module. If enabled, it intercepts browser navigation to same-origin locations, and fires a callback instead.

Usage

import { onRouteChange } from '/src/gluon-router.js';

// This callback is fired whenever a navigation takes place, and passes the path, query parameters, and hash of the new location
onRouteChange((path, query, hash) => {
  console.log("PATH: ", path);
  console.log("QUERY: ", query);
  console.log("HASH: ", hash);
});

About Gluonjs

Gluonjs is a minimal Web Component framework designed for simplicity and speed. It borrows some ideas from Polymer, but is mostly based on platform features. The source for the ES6 version is only ~40 lines of javascript.

Dependents (0)

Package Sidebar

Install

npm i gluonjs-router

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • ruphin