{"name":"catch-links","version":"0.0.0","description":"intercept local link clicks on a page","main":"index.js","scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/catch-links.git"},"homepage":"https://github.com/substack/catch-links","keywords":["link","browser","click"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","_id":"catch-links@0.0.0","dist":{"shasum":"55490aab2634d5cf01f7ca0f68d4d594748dcc56","tarball":"http://registry-npm.ywwl.com/catch-links/download/catch-links-0.0.0.tgz","integrity":"sha512-z+m7wSkVhxjui9wlnm9f0vNe+paKf9YXdMSFudJxgNO84G5a+7kdu6MYpAV4sCUaVucfLZPB7MdHM1E1wS2CbQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrDrL513myPF5bj+2dvNfaJrrFaaPdpSNmr/10nk7RAgIgBWDpP6hMiKNF3llDpU60o510+UshmpY+U5X97LjNX8k="}],"size":2022,"noattachment":false,"key":"/catch-links/-/catch-links-0.0.0.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"directories":{},"readme":"# catch-links\n\nintercept local link clicks on a page\n\nThis is useful for doing client-side pushState UIs.\n\n# example\n\nGiven some html:\n\n``` html\n<html>\n  <body>\n    <div>\n      <a href=\"/a\">aaa</a>\n    </div>\n\n    <div>\n      <a href=\"/b\">bbb</a>\n    </div>\n\n    <div>\n      <a href=\"cc\">cc</a>\n    </div>\n    \n    <div>\n      <a href=\"http://npmjs.org\">npmjs</a>\n    </div>\n    \n    <script src=\"bundle.js\"></script>\n  </body>\n</html>\n```\n\nWe'll intercept the relative links `<host>/a` and `<host>/b`, printing them.\nThe external link to npmjs.org will go through as usual.\n\n``` js\nvar catchLinks = require('catch-links');\n\ncatchLinks(window, function (href) {\n    console.log(href);\n});\n```\n\n# methods\n\n``` js\nvar catchLinks = require('catch-links')\n```\n\n## catchLinks(element, cb)\n\nFire `cb(href)` whenever an anchor tag descendant of `element` with an in-server\nurl is clicked.\n\n`href` will always be a relative path rooted at the root path.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install catch-links\n```\n\nUse [browserify](http://browserify.org) to bundle this library into your\nproject.\n\n# license\n\nMIT\n","publish_time":1356606621690,"_cnpm_publish_time":1356606621690,"dist-tags":{"latest":"2.0.1"}}