New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bicycle-codes/catch-links

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bicycle-codes/catch-links

Intercept local link clicks

  • 0.2.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
increased by750%
Maintainers
0
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.

install

npm i -S @bicycle-codes/catch-links

use

common JS

const catchLinks = require('@bicycle-codes/catch-links').default

ESM

import CatchLinks from '@bicycle-codes/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 '@bicycle-codes/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 20 Oct 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc