Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/link-delegate
Anchor tag click delegation / negotiation for simplifying client-side routing
https://github.com/component/link-delegate
Last synced: 13 days ago
JSON representation
Anchor tag click delegation / negotiation for simplifying client-side routing
- Host: GitHub
- URL: https://github.com/component/link-delegate
- Owner: component
- Created: 2013-05-02T19:42:18.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-04-29T19:21:09.000Z (over 7 years ago)
- Last Synced: 2024-10-31T09:12:27.917Z (about 2 months ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 8
- Watchers: 7
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# link-delegate
Anchor tag click delegation / negotiation for client-side routing. This component
makes it easy to implement application-wide push-state link handling without
manually performing a router dispatch.## Installation
$ component install component/link-delegate
## Example
The callback is invoked with an `Event` when the link:
- is not x-domain
- is the primary "mouse" button
- does not have `e.defaultPrevented` (to opt-out)
- does not specify a `target`
- does not have the meta, ctrl, or shift key pressed```js
var link = require('link-delegate');link(function(e){
// perform your routing here
e.preventDefault();
console.log(e.target.href);
});
```## License
MIT