
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
javascript-router
Advanced tools
A vanilla js router implementation 🔗
A simple Javascript UI router. Written in typescript and bundled as a es6 module for use with Webpack or Rollup.
Install using npm and webpack/rollup etc.
npm install javascript-router
Import as module.
import { Router } from 'javascript-router';
const prefix = '/hello';
const router = new Router(prefix);
Add routes to the router.
router.on('/', () => {
// Perform action on route
});
On functions can be chained.
router.on('/blog', () => {
// Perform action on router
}).on('/posts', () => {
// Perform action on router
});
When all routes are added call init().
router.on('/blog', () => {
// Perform action on router
}).on('/posts', () => {
// Perform action on router
});
router.init();
To create router links use the data-router attribute on link elements.
<a href="/blog" data-router>Link</a>
If the DOM is re-rendered or more links are added to the page the redefineLinks function must be called again.
router.redefineLinks();
Parameters and queries are passed into the .on() function.
router.on('/blog', (query, params) => {
// Perform action on router
console.log(query, params);
});
FAQs
A lightweight javascript router
The npm package javascript-router receives a total of 1 weekly downloads. As such, javascript-router popularity was classified as not popular.
We found that javascript-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.