{"name":"catch-links","version":"1.0.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":"66c9426f4ee8ef03993e4bd999dc6f3a32d32b64","bugs":{"url":"https://github.com/substack/catch-links/issues"},"_id":"catch-links@1.0.0","_shasum":"fa6744b5cab9bafe2176dd7e043a3c10e20bd99a","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.12.0","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"dist":{"shasum":"fa6744b5cab9bafe2176dd7e043a3c10e20bd99a","tarball":"http://registry-npm.ywwl.com/catch-links/download/catch-links-1.0.0.tgz","integrity":"sha512-roE7aTfUiO4VLaHGZTSVoxSiAVekiigZc+Q39Ezc7hlg+Ad6LQiLNVttmachUMfcxqW8HHdP3Ywszmy3SOTIjw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDbztDPbGXrJrV0ZMDETh2KJz98FRjB9qeC6txa1bbvXAiEAwiENqWEyDRpKlKyIr+AUXWT6Udd3SyrdFkYmWCzRWqQ="}],"size":2017,"noattachment":false,"key":"/catch-links/-/catch-links-1.0.0.tgz"},"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":1425548874485,"_cnpm_publish_time":1425548874485,"dist-tags":{"latest":"2.0.1"}}