{"name":"catch-links","version":"2.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":"b23d698662205afdedecdfaa0251178ff99ea639","bugs":{"url":"https://github.com/substack/catch-links/issues"},"_id":"catch-links@2.0.0","_shasum":"e12eb6ba68221e9470ccadbd6670bdc58fca326f","_from":".","_npmVersion":"3.0.0","_nodeVersion":"2.0.0","_npmUser":{"name":"substack","email":"substack@gmail.com"},"dist":{"shasum":"e12eb6ba68221e9470ccadbd6670bdc58fca326f","tarball":"http://registry-npm.ywwl.com/catch-links/download/catch-links-2.0.0.tgz","integrity":"sha512-oNV7pmwHanBBwQwifaR6CyP2AhF7DGC/BSWdEk+Xn19Da+eO1dyFMmGc5mIaKePrtqxzluCvC+wekZb6b9i2/g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGunhXfdHm3bt4oWTDBkAk8bLUJMW2AGs5GlJbmnDXvyAiEA9NnkOumhfQ5BMGAshTOs347p6U4kTMLwo0ASFlPweps="}],"size":2109,"noattachment":false,"key":"/catch-links/-/catch-links-2.0.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":1435779363539,"_cnpm_publish_time":1435779363539,"dist-tags":{"latest":"2.0.1"}}