{"name":"catch-links","version":"1.1.0","description":"intercept local link clicks on a page","main":"index.js","scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/catch-links.git"},"homepage":"https://github.com/substack/catch-links","keywords":["link","browser","click","intercept","spa","single-page app"],"author":{"name":"substack"},"license":"MIT","devDependencies":{"tape":"^3.5.0"},"gitHead":"07912629b66ecf16239102203ee60a2996d56f4b","bugs":{"url":"https://github.com/substack/catch-links/issues"},"_id":"catch-links@1.1.0","_shasum":"a15aa8e0d345af4b793f0ec73c5a2f28149ccb65","_from":".","_npmVersion":"2.9.0","_nodeVersion":"2.0.0","_npmUser":{"name":"substack","email":"substack@gmail.com"},"dist":{"shasum":"a15aa8e0d345af4b793f0ec73c5a2f28149ccb65","tarball":"http://registry-npm.ywwl.com/catch-links/download/catch-links-1.1.0.tgz","integrity":"sha512-68WP255r7be94WFvUotVJSRHiRCNxTlwtqeULLQFz7sTQMJpx3FyFXsixBKSmhsfmA7wOeAAZO3PkYux5aPUgw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFq7lpip91d1/cmN6s0YxEHEw7Hb0XHDtsU5ZpQTIkMkAiEAhtGHqZxN295p2SfQqUWajNnzE69VUB3nww7ZReL47po="}],"size":2013,"noattachment":false,"key":"/catch-links/-/catch-links-1.1.0.tgz"},"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":1431035883279,"_cnpm_publish_time":1431035883279,"dist-tags":{"latest":"2.0.1"}}