🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@substrate-system/catch-links

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@substrate-system/catch-links

Intercept local link clicks

0.2.14
latest
Source
npm
Version published
Weekly downloads
84
-6.67%
Maintainers
1
Weekly downloads
 
Created
Source

tests Socket Badge types module dependencies semantic versioning license

Like the classic @substack module, but updated.

Intercept local link clicks on a page, for client-side pushState UIs.

This is used as a part of route-event. That is the recommended way to consume this.

Contents

install

npm i -S @substrate-system/catch-links

use

common JS

const catchLinks = require('@substrate-system/catch-links').default

ESM

import CatchLinks from '@substrate-system/catch-links'

example

Given this HTML,

<body>
    <a id="local-link" href="/foo">local</a>
    <a href="https://www.npmjs.com/" id="remote-link">remote</a>
</body>

Use this JS:

import CatchLinks from '@substrate-system/catch-links'

// given a click on `#local-link`
CatchLinks(document.body, function onLinkClick (href) {
    // this will not be called on click to #remote-link

    console.log('href', href)
    // => '/foo'
})

FAQs

Package last updated on 04 Jun 2025

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