{"name":"catch-links","version":"0.0.1","description":"intercept local link clicks on a page","main":"index.js","devDependencies":{"tape":"~0.2.2","tap":"~0.4.0","ever":"~0.0.3"},"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.1","dist":{"shasum":"1a022d305a395453e5884a156c1ff1ac0cb50669","tarball":"http://registry-npm.ywwl.com/catch-links/download/catch-links-0.0.1.tgz","integrity":"sha512-Q2Bfd6vvwa7WO7MP+1WsPlzbbr/0DZ1Leb8oTnCIqZDkXS8Bxcev+bJelDH06j+lOZFWPhq1FMdcqjxWKoCOVQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFpK57LVjEfcRIrOn9aY9rJ3eRe8YlfswOMu/HZpKgHWAiB6mk5QczR8Qlpx1OHQ1ifaottRja/cko92aaHI7UGsuQ=="}],"size":2242,"noattachment":false,"key":"/catch-links/-/catch-links-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.2","_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":1366415083302,"_cnpm_publish_time":1366415083302,"dist-tags":{"latest":"2.0.1"}}