{"action":"created","comment":{"url":"https://api.github.com/repos/hyperapp/router/pulls/comments/178260770","pull_request_review_id":108295628,"id":178260770,"diff_hunk":"@@ -4,12 +4,17 @@ export function Link(props, children) {\n   return function(state, actions) {\n     var to = props.to\n     var location = state.location || window.location\n+    var onclick = props.onclick\n     delete props.to\n     delete props.location\n \n     props.href = to\n     props.onclick = function(e) {\n+      if (onclick) {\n+        onclick(e)\n+      }\n       if (\n+        e.defaultPrevented ||","path":"src/Link.js","position":14,"original_position":14,"commit_id":"47852483018b7f2fe1df84929a35f1ee4ed9c3fc","original_commit_id":"47852483018b7f2fe1df84929a35f1ee4ed9c3fc","user":{"login":"jorgebucaran","id":56996,"avatar_url":"https://avatars1.githubusercontent.com/u/56996?v=4","gravatar_id":"","url":"https://api.github.com/users/jorgebucaran","html_url":"https://github.com/jorgebucaran","followers_url":"https://api.github.com/users/jorgebucaran/followers","following_url":"https://api.github.com/users/jorgebucaran/following{/other_user}","gists_url":"https://api.github.com/users/jorgebucaran/gists{/gist_id}","starred_url":"https://api.github.com/users/jorgebucaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorgebucaran/subscriptions","organizations_url":"https://api.github.com/users/jorgebucaran/orgs","repos_url":"https://api.github.com/users/jorgebucaran/repos","events_url":"https://api.github.com/users/jorgebucaran/events{/privacy}","received_events_url":"https://api.github.com/users/jorgebucaran/received_events","type":"User","site_admin":false},"body":"@frenzzy I imagine this works because `e` is mutated when `e.preventDefault()` is run?","created_at":"2018-03-30T09:16:32Z","updated_at":"2018-03-30T09:16:32Z","html_url":"https://github.com/hyperapp/router/pull/61#discussion_r178260770","pull_request_url":"https://api.github.com/repos/hyperapp/router/pulls/61","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/hyperapp/router/pulls/comments/178260770"},"html":{"href":"https://github.com/hyperapp/router/pull/61#discussion_r178260770"},"pull_request":{"href":"https://api.github.com/repos/hyperapp/router/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/hyperapp/router/pulls/61","id":178521458,"html_url":"https://github.com/hyperapp/router/pull/61","diff_url":"https://github.com/hyperapp/router/pull/61.diff","patch_url":"https://github.com/hyperapp/router/pull/61.patch","issue_url":"https://api.github.com/repos/hyperapp/router/issues/61","number":61,"state":"open","locked":false,"title":"Custom Link.onclick handler","user":{"login":"frenzzy","id":640669,"avatar_url":"https://avatars2.githubusercontent.com/u/640669?v=4","gravatar_id":"","url":"https://api.github.com/users/frenzzy","html_url":"https://github.com/frenzzy","followers_url":"https://api.github.com/users/frenzzy/followers","following_url":"https://api.github.com/users/frenzzy/following{/other_user}","gists_url":"https://api.github.com/users/frenzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/frenzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frenzzy/subscriptions","organizations_url":"https://api.github.com/users/frenzzy/orgs","repos_url":"https://api.github.com/users/frenzzy/repos","events_url":"https://api.github.com/users/frenzzy/events{/privacy}","received_events_url":"https://api.github.com/users/frenzzy/received_events","type":"User","site_admin":false},"body":"The `onclick` attribute is not longer ignored and it allows you to prevent page transition depends on various conditions:\r\n```js\r\n<Link\r\n  onclick={e => {\r\n    if (condition) {\r\n      // prevent page transition if condition is true\r\n      e.preventDefault()\r\n    }\r\n  }}\r\n/>\r\n```","created_at":"2018-03-30T08:54:54Z","updated_at":"2018-03-30T09:16:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"118e8daa016a31df480e81a361e58f9e4182cdb6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":196563075,"url":"https://api.github.com/repos/hyperapp/router/labels/DISCUSSION","name":"DISCUSSION","color":"fbca04","default":false},{"id":196563072,"url":"https://api.github.com/repos/hyperapp/router/labels/FEATURE","name":"FEATURE","color":"0052cc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/hyperapp/router/pulls/61/commits","review_comments_url":"https://api.github.com/repos/hyperapp/router/pulls/61/comments","review_comment_url":"https://api.github.com/repos/hyperapp/router/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hyperapp/router/issues/61/comments","statuses_url":"https://api.github.com/repos/hyperapp/router/statuses/47852483018b7f2fe1df84929a35f1ee4ed9c3fc","head":{"label":"frenzzy:link-onclick","ref":"link-onclick","sha":"47852483018b7f2fe1df84929a35f1ee4ed9c3fc","user":{"login":"frenzzy","id":640669,"avatar_url":"https://avatars2.githubusercontent.com/u/640669?v=4","gravatar_id":"","url":"https://api.github.com/users/frenzzy","html_url":"https://github.com/frenzzy","followers_url":"https://api.github.com/users/frenzzy/followers","following_url":"https://api.github.com/users/frenzzy/following{/other_user}","gists_url":"https://api.github.com/users/frenzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/frenzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frenzzy/subscriptions","organizations_url":"https://api.github.com/users/frenzzy/orgs","repos_url":"https://api.github.com/users/frenzzy/repos","events_url":"https://api.github.com/users/frenzzy/events{/privacy}","received_events_url":"https://api.github.com/users/frenzzy/received_events","type":"User","site_admin":false},"repo":{"id":127405324,"name":"router","full_name":"frenzzy/router","owner":{"login":"frenzzy","id":640669,"avatar_url":"https://avatars2.githubusercontent.com/u/640669?v=4","gravatar_id":"","url":"https://api.github.com/users/frenzzy","html_url":"https://github.com/frenzzy","followers_url":"https://api.github.com/users/frenzzy/followers","following_url":"https://api.github.com/users/frenzzy/following{/other_user}","gists_url":"https://api.github.com/users/frenzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/frenzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frenzzy/subscriptions","organizations_url":"https://api.github.com/users/frenzzy/orgs","repos_url":"https://api.github.com/users/frenzzy/repos","events_url":"https://api.github.com/users/frenzzy/events{/privacy}","received_events_url":"https://api.github.com/users/frenzzy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/frenzzy/router","description":"Declarative routing for Hyperapp using the History API.","fork":true,"url":"https://api.github.com/repos/frenzzy/router","forks_url":"https://api.github.com/repos/frenzzy/router/forks","keys_url":"https://api.github.com/repos/frenzzy/router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/frenzzy/router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/frenzzy/router/teams","hooks_url":"https://api.github.com/repos/frenzzy/router/hooks","issue_events_url":"https://api.github.com/repos/frenzzy/router/issues/events{/number}","events_url":"https://api.github.com/repos/frenzzy/router/events","assignees_url":"https://api.github.com/repos/frenzzy/router/assignees{/user}","branches_url":"https://api.github.com/repos/frenzzy/router/branches{/branch}","tags_url":"https://api.github.com/repos/frenzzy/router/tags","blobs_url":"https://api.github.com/repos/frenzzy/router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/frenzzy/router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/frenzzy/router/git/refs{/sha}","trees_url":"https://api.github.com/repos/frenzzy/router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/frenzzy/router/statuses/{sha}","languages_url":"https://api.github.com/repos/frenzzy/router/languages","stargazers_url":"https://api.github.com/repos/frenzzy/router/stargazers","contributors_url":"https://api.github.com/repos/frenzzy/router/contributors","subscribers_url":"https://api.github.com/repos/frenzzy/router/subscribers","subscription_url":"https://api.github.com/repos/frenzzy/router/subscription","commits_url":"https://api.github.com/repos/frenzzy/router/commits{/sha}","git_commits_url":"https://api.github.com/repos/frenzzy/router/git/commits{/sha}","comments_url":"https://api.github.com/repos/frenzzy/router/comments{/number}","issue_comment_url":"https://api.github.com/repos/frenzzy/router/issues/comments{/number}","contents_url":"https://api.github.com/repos/frenzzy/router/contents/{+path}","compare_url":"https://api.github.com/repos/frenzzy/router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/frenzzy/router/merges","archive_url":"https://api.github.com/repos/frenzzy/router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/frenzzy/router/downloads","issues_url":"https://api.github.com/repos/frenzzy/router/issues{/number}","pulls_url":"https://api.github.com/repos/frenzzy/router/pulls{/number}","milestones_url":"https://api.github.com/repos/frenzzy/router/milestones{/number}","notifications_url":"https://api.github.com/repos/frenzzy/router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/frenzzy/router/labels{/name}","releases_url":"https://api.github.com/repos/frenzzy/router/releases{/id}","deployments_url":"https://api.github.com/repos/frenzzy/router/deployments","created_at":"2018-03-30T08:49:24Z","updated_at":"2018-03-30T08:49:26Z","pushed_at":"2018-03-30T08:50:44Z","git_url":"git://github.com/frenzzy/router.git","ssh_url":"git@github.com:frenzzy/router.git","clone_url":"https://github.com/frenzzy/router.git","svn_url":"https://github.com/frenzzy/router","homepage":"","size":67,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hyperapp:master","ref":"master","sha":"2197ff269a83d5ab71bc632df9d3301d573461ed","user":{"login":"hyperapp","id":25238911,"avatar_url":"https://avatars2.githubusercontent.com/u/25238911?v=4","gravatar_id":"","url":"https://api.github.com/users/hyperapp","html_url":"https://github.com/hyperapp","followers_url":"https://api.github.com/users/hyperapp/followers","following_url":"https://api.github.com/users/hyperapp/following{/other_user}","gists_url":"https://api.github.com/users/hyperapp/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperapp/subscriptions","organizations_url":"https://api.github.com/users/hyperapp/orgs","repos_url":"https://api.github.com/users/hyperapp/repos","events_url":"https://api.github.com/users/hyperapp/events{/privacy}","received_events_url":"https://api.github.com/users/hyperapp/received_events","type":"Organization","site_admin":false},"repo":{"id":33520773,"name":"router","full_name":"hyperapp/router","owner":{"login":"hyperapp","id":25238911,"avatar_url":"https://avatars2.githubusercontent.com/u/25238911?v=4","gravatar_id":"","url":"https://api.github.com/users/hyperapp","html_url":"https://github.com/hyperapp","followers_url":"https://api.github.com/users/hyperapp/followers","following_url":"https://api.github.com/users/hyperapp/following{/other_user}","gists_url":"https://api.github.com/users/hyperapp/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperapp/subscriptions","organizations_url":"https://api.github.com/users/hyperapp/orgs","repos_url":"https://api.github.com/users/hyperapp/repos","events_url":"https://api.github.com/users/hyperapp/events{/privacy}","received_events_url":"https://api.github.com/users/hyperapp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperapp/router","description":"Declarative routing for Hyperapp using the History API.","fork":false,"url":"https://api.github.com/repos/hyperapp/router","forks_url":"https://api.github.com/repos/hyperapp/router/forks","keys_url":"https://api.github.com/repos/hyperapp/router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperapp/router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperapp/router/teams","hooks_url":"https://api.github.com/repos/hyperapp/router/hooks","issue_events_url":"https://api.github.com/repos/hyperapp/router/issues/events{/number}","events_url":"https://api.github.com/repos/hyperapp/router/events","assignees_url":"https://api.github.com/repos/hyperapp/router/assignees{/user}","branches_url":"https://api.github.com/repos/hyperapp/router/branches{/branch}","tags_url":"https://api.github.com/repos/hyperapp/router/tags","blobs_url":"https://api.github.com/repos/hyperapp/router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperapp/router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperapp/router/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperapp/router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperapp/router/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperapp/router/languages","stargazers_url":"https://api.github.com/repos/hyperapp/router/stargazers","contributors_url":"https://api.github.com/repos/hyperapp/router/contributors","subscribers_url":"https://api.github.com/repos/hyperapp/router/subscribers","subscription_url":"https://api.github.com/repos/hyperapp/router/subscription","commits_url":"https://api.github.com/repos/hyperapp/router/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperapp/router/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperapp/router/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperapp/router/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperapp/router/contents/{+path}","compare_url":"https://api.github.com/repos/hyperapp/router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperapp/router/merges","archive_url":"https://api.github.com/repos/hyperapp/router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperapp/router/downloads","issues_url":"https://api.github.com/repos/hyperapp/router/issues{/number}","pulls_url":"https://api.github.com/repos/hyperapp/router/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperapp/router/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperapp/router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperapp/router/labels{/name}","releases_url":"https://api.github.com/repos/hyperapp/router/releases{/id}","deployments_url":"https://api.github.com/repos/hyperapp/router/deployments","created_at":"2015-04-07T03:51:44Z","updated_at":"2018-03-30T03:16:23Z","pushed_at":"2018-03-30T08:54:55Z","git_url":"git://github.com/hyperapp/router.git","ssh_url":"git@github.com:hyperapp/router.git","clone_url":"https://github.com/hyperapp/router.git","svn_url":"https://github.com/hyperapp/router","homepage":"","size":67,"stargazers_count":190,"watchers_count":190,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":32,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":32,"open_issues":17,"watchers":190,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hyperapp/router/pulls/61"},"html":{"href":"https://github.com/hyperapp/router/pull/61"},"issue":{"href":"https://api.github.com/repos/hyperapp/router/issues/61"},"comments":{"href":"https://api.github.com/repos/hyperapp/router/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/hyperapp/router/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/hyperapp/router/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hyperapp/router/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/hyperapp/router/statuses/47852483018b7f2fe1df84929a35f1ee4ed9c3fc"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jorgebucaran"}}