0.2.4 • Published 1 year ago

@nichoth/catch-links v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

catch links

dependencies types module license

Like the classic @substack module, but updated.

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

install

npm i -S @nichoth/catch-links

use

common JS

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

ESM

import CatchLinks from '@nichoth/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 '@nichoth/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'
})
0.2.4

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.0.14

2 years ago

0.1.0

2 years ago

0.0.12

2 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago