{"action":"created","comment":{"url":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/comments/70009918","id":70009918,"diff_hunk":"@@ -175,6 +225,181 @@\n     }\n   }\n \n+  // Setup breadcrumbs for click events\n+  function trackClicks() {\n+    if(!getBreadcrumbSetting(\"autoBreadcrumbsClicks\", true)) {\n+      return;\n+    }\n+\n+    window.addEventListener(\"click\", function(event) {\n+      self.leaveBreadcrumb({\n+        type: \"user\",\n+        name: \"UI click\",\n+        metaData: {\n+          targetText: nodeText(event.target),\n+          targetSelector: nodeLabel(event.target)\n+        }\n+      });\n+    });\n+  }\n+\n+  // Setup breadcrumbs for console.log, console.warn, console.error\n+  function trackConsoleLog(){\n+    if(!getBreadcrumbSetting(\"autoBreadcrumbsConsole\")) {\n+      return;\n+    }\n+\n+    function trackLog(level, args) {\n+      self.leaveBreadcrumb({\n+        type: \"log\",\n+        name: \"Console output\",\n+        metaData: {\n+          level: level,\n+          values: Array.prototype.slice.call(args)\n+        }\n+      });\n+    }\n+\n+    enhance(console, \"log\", function() {\n+      trackLog(\"log\", arguments);\n+    });\n+\n+    enhance(console, \"warn\", function() {\n+      trackLog(\"warn\", arguments);\n+    });\n+\n+    enhance(console, \"error\", function() {\n+      trackLog(\"error\", arguments);\n+    });\n+  }\n+\n+  // Setup breadcrumbs for history navigation events\n+  function trackNavigation() {\n+    if(!getBreadcrumbSetting(\"autoBreadcrumbsNavigation\")) {\n+      return;\n+    }\n+\n+    // check for browser support\n+    if (!history || !history.state || !history.pushState || !window.history.pushState.bind) {","path":"src/bugsnag.js","position":123,"original_position":123,"commit_id":"0f841fe74fd1db8f00ab2d09c91e79bae8412cdf","original_commit_id":"0f841fe74fd1db8f00ab2d09c91e79bae8412cdf","user":{"login":"eanakashima","id":187987,"avatar_url":"https://avatars.githubusercontent.com/u/187987?v=3","gravatar_id":"","url":"https://api.github.com/users/eanakashima","html_url":"https://github.com/eanakashima","followers_url":"https://api.github.com/users/eanakashima/followers","following_url":"https://api.github.com/users/eanakashima/following{/other_user}","gists_url":"https://api.github.com/users/eanakashima/gists{/gist_id}","starred_url":"https://api.github.com/users/eanakashima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eanakashima/subscriptions","organizations_url":"https://api.github.com/users/eanakashima/orgs","repos_url":"https://api.github.com/users/eanakashima/repos","events_url":"https://api.github.com/users/eanakashima/events{/privacy}","received_events_url":"https://api.github.com/users/eanakashima/received_events","type":"User","site_admin":false},"body":"If `window.history` is undefined in older browsers, I believe the first part of this will still throw, unless we are doing `var history = window.history` someplace I missed?","created_at":"2016-07-08T00:20:35Z","updated_at":"2016-07-08T00:20:35Z","html_url":"https://github.com/bugsnag/bugsnag-js/pull/149#discussion_r70009918","pull_request_url":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/149","_links":{"self":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/comments/70009918"},"html":{"href":"https://github.com/bugsnag/bugsnag-js/pull/149#discussion_r70009918"},"pull_request":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/149"}}},"pull_request":{"url":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/149","id":76646092,"html_url":"https://github.com/bugsnag/bugsnag-js/pull/149","diff_url":"https://github.com/bugsnag/bugsnag-js/pull/149.diff","patch_url":"https://github.com/bugsnag/bugsnag-js/pull/149.patch","issue_url":"https://api.github.com/repos/bugsnag/bugsnag-js/issues/149","number":149,"state":"open","locked":false,"title":"Breadcrumbs","user":{"login":"wordofchristian","id":555044,"avatar_url":"https://avatars.githubusercontent.com/u/555044?v=3","gravatar_id":"","url":"https://api.github.com/users/wordofchristian","html_url":"https://github.com/wordofchristian","followers_url":"https://api.github.com/users/wordofchristian/followers","following_url":"https://api.github.com/users/wordofchristian/following{/other_user}","gists_url":"https://api.github.com/users/wordofchristian/gists{/gist_id}","starred_url":"https://api.github.com/users/wordofchristian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordofchristian/subscriptions","organizations_url":"https://api.github.com/users/wordofchristian/orgs","repos_url":"https://api.github.com/users/wordofchristian/repos","events_url":"https://api.github.com/users/wordofchristian/events{/privacy}","received_events_url":"https://api.github.com/users/wordofchristian/received_events","type":"User","site_admin":false},"body":"The UI isn't yet ready on Bugsnag.com but here is a screenshot:\r\n\r\n![breadcrumbs1](https://cloud.githubusercontent.com/assets/555044/16664798/a4de2a04-4436-11e6-9805-3865245a2d1b.png)\r\n\r\n\r\n##  Bugsnag.leaveBreadcrumb(value)\r\n\r\nAdd a breadcrumb to the array of breadcrumbs to be sent to Bugsnag when the next exception occurs\r\n `value` can be a string or an object with the following structure:\r\n\r\n- `timestamp` (optional, Date) - The time at which the event was recorded, in ISO 8601 format (`yyyy-mm-ddTHH:mm:ssZ`)\r\n- `name` (optional, string) [default: \"Custom\"] - The name of the breadcrumb, limited to 30 characters\r\n- `type`  (optional, enum) [default: \"custom\"] - The type of breadcrumb, from a list of options explained below\r\n  - `navigation`\r\n  - `request`\r\n  - `process`\r\n  - `log`\r\n  - `user`\r\n  - `state`\r\n  - `error`\r\n  - `custom`\r\n- `metadata` (optional, object) - Additional information about the breadcrumb. Values limited to 140 characters.\r\n\r\nThe last 25 breadcrumbs get stored and sent along with all payloads to bugsnag.\r\n\r\n## Automatic breadcrumbs\r\n\r\nIncludes automatic creation of breadcrumbs for certain events.\r\n\r\n- **Clicks**\r\n- **Errors**\r\n- **Console**\r\n  - log\r\n  - warn\r\n  - error\r\n- **Navigation**\r\n  - Page load\r\n  - DOMContentLoaded\r\n  - Page hide\r\n  - Page show\r\n  - popstate\r\n  - history.pushState\r\n  - history.replaceState\r\n\r\n\r\n## New configuration options\r\n\r\nTo disable all automatic breadcrumbs.\r\n\r\n```javascript\r\nBugsnag.autoBreadcrumbs = false;\r\n```\r\n\r\nYou can also disable any individual automatic breadcrumb groups:\r\n\r\n```javascript\r\nBugsnag.autoBreadcrumbsClicks = false;\r\nBugsnag.autoBreadcrumbsErrors = false;\r\nBugsnag.autoBreadcrumbsConsole = false;\r\nBugsnag.autoBreadcrumbsNavigation = false;\r\n```\r\n\r\nIf you only want to enable a single type of automatic breadcrumb you can disable all of them and then\r\nenable the individual group you want:\r\n\r\n```javascript\r\n// disable all automatic breadcrumbs except click events\r\nBugsnag.autoBreadcrumbs = false;\r\nBugsnag.autoBreadcrumbsClicks = true;\r\n```\r\n\r\n## TODO\r\n\r\n- [x] Add typescript header for leaveBreadcrumb\r\n- [ ] Address remaining inline TODO comments in the diff\r\n- [ ] ???","created_at":"2016-07-07T18:49:17Z","updated_at":"2016-07-08T00:20:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34974cabf11fc2913fad60bd469f90dca844bdad","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/149/commits","review_comments_url":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/149/comments","review_comment_url":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bugsnag/bugsnag-js/issues/149/comments","statuses_url":"https://api.github.com/repos/bugsnag/bugsnag-js/statuses/0f841fe74fd1db8f00ab2d09c91e79bae8412cdf","head":{"label":"bugsnag:breadcrumbs","ref":"breadcrumbs","sha":"0f841fe74fd1db8f00ab2d09c91e79bae8412cdf","user":{"login":"bugsnag","id":1058895,"avatar_url":"https://avatars.githubusercontent.com/u/1058895?v=3","gravatar_id":"","url":"https://api.github.com/users/bugsnag","html_url":"https://github.com/bugsnag","followers_url":"https://api.github.com/users/bugsnag/followers","following_url":"https://api.github.com/users/bugsnag/following{/other_user}","gists_url":"https://api.github.com/users/bugsnag/gists{/gist_id}","starred_url":"https://api.github.com/users/bugsnag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugsnag/subscriptions","organizations_url":"https://api.github.com/users/bugsnag/orgs","repos_url":"https://api.github.com/users/bugsnag/repos","events_url":"https://api.github.com/users/bugsnag/events{/privacy}","received_events_url":"https://api.github.com/users/bugsnag/received_events","type":"Organization","site_admin":false},"repo":{"id":8035735,"name":"bugsnag-js","full_name":"bugsnag/bugsnag-js","owner":{"login":"bugsnag","id":1058895,"avatar_url":"https://avatars.githubusercontent.com/u/1058895?v=3","gravatar_id":"","url":"https://api.github.com/users/bugsnag","html_url":"https://github.com/bugsnag","followers_url":"https://api.github.com/users/bugsnag/followers","following_url":"https://api.github.com/users/bugsnag/following{/other_user}","gists_url":"https://api.github.com/users/bugsnag/gists{/gist_id}","starred_url":"https://api.github.com/users/bugsnag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugsnag/subscriptions","organizations_url":"https://api.github.com/users/bugsnag/orgs","repos_url":"https://api.github.com/users/bugsnag/repos","events_url":"https://api.github.com/users/bugsnag/events{/privacy}","received_events_url":"https://api.github.com/users/bugsnag/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bugsnag/bugsnag-js","description":"Javascript notifier for Bugsnag.","fork":false,"url":"https://api.github.com/repos/bugsnag/bugsnag-js","forks_url":"https://api.github.com/repos/bugsnag/bugsnag-js/forks","keys_url":"https://api.github.com/repos/bugsnag/bugsnag-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bugsnag/bugsnag-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bugsnag/bugsnag-js/teams","hooks_url":"https://api.github.com/repos/bugsnag/bugsnag-js/hooks","issue_events_url":"https://api.github.com/repos/bugsnag/bugsnag-js/issues/events{/number}","events_url":"https://api.github.com/repos/bugsnag/bugsnag-js/events","assignees_url":"https://api.github.com/repos/bugsnag/bugsnag-js/assignees{/user}","branches_url":"https://api.github.com/repos/bugsnag/bugsnag-js/branches{/branch}","tags_url":"https://api.github.com/repos/bugsnag/bugsnag-js/tags","blobs_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bugsnag/bugsnag-js/statuses/{sha}","languages_url":"https://api.github.com/repos/bugsnag/bugsnag-js/languages","stargazers_url":"https://api.github.com/repos/bugsnag/bugsnag-js/stargazers","contributors_url":"https://api.github.com/repos/bugsnag/bugsnag-js/contributors","subscribers_url":"https://api.github.com/repos/bugsnag/bugsnag-js/subscribers","subscription_url":"https://api.github.com/repos/bugsnag/bugsnag-js/subscription","commits_url":"https://api.github.com/repos/bugsnag/bugsnag-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/bugsnag/bugsnag-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/bugsnag/bugsnag-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/bugsnag/bugsnag-js/contents/{+path}","compare_url":"https://api.github.com/repos/bugsnag/bugsnag-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bugsnag/bugsnag-js/merges","archive_url":"https://api.github.com/repos/bugsnag/bugsnag-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bugsnag/bugsnag-js/downloads","issues_url":"https://api.github.com/repos/bugsnag/bugsnag-js/issues{/number}","pulls_url":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls{/number}","milestones_url":"https://api.github.com/repos/bugsnag/bugsnag-js/milestones{/number}","notifications_url":"https://api.github.com/repos/bugsnag/bugsnag-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bugsnag/bugsnag-js/labels{/name}","releases_url":"https://api.github.com/repos/bugsnag/bugsnag-js/releases{/id}","deployments_url":"https://api.github.com/repos/bugsnag/bugsnag-js/deployments","created_at":"2013-02-05T19:06:33Z","updated_at":"2016-07-07T10:39:26Z","pushed_at":"2016-07-07T19:07:09Z","git_url":"git://github.com/bugsnag/bugsnag-js.git","ssh_url":"git@github.com:bugsnag/bugsnag-js.git","clone_url":"https://github.com/bugsnag/bugsnag-js.git","svn_url":"https://github.com/bugsnag/bugsnag-js","homepage":"http://bugsnag.com/","size":746,"stargazers_count":180,"watchers_count":180,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":11,"forks":61,"open_issues":11,"watchers":180,"default_branch":"master"}},"base":{"label":"bugsnag:master","ref":"master","sha":"a82fc0d0ef796cd315748b095c5c508a96ac55bd","user":{"login":"bugsnag","id":1058895,"avatar_url":"https://avatars.githubusercontent.com/u/1058895?v=3","gravatar_id":"","url":"https://api.github.com/users/bugsnag","html_url":"https://github.com/bugsnag","followers_url":"https://api.github.com/users/bugsnag/followers","following_url":"https://api.github.com/users/bugsnag/following{/other_user}","gists_url":"https://api.github.com/users/bugsnag/gists{/gist_id}","starred_url":"https://api.github.com/users/bugsnag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugsnag/subscriptions","organizations_url":"https://api.github.com/users/bugsnag/orgs","repos_url":"https://api.github.com/users/bugsnag/repos","events_url":"https://api.github.com/users/bugsnag/events{/privacy}","received_events_url":"https://api.github.com/users/bugsnag/received_events","type":"Organization","site_admin":false},"repo":{"id":8035735,"name":"bugsnag-js","full_name":"bugsnag/bugsnag-js","owner":{"login":"bugsnag","id":1058895,"avatar_url":"https://avatars.githubusercontent.com/u/1058895?v=3","gravatar_id":"","url":"https://api.github.com/users/bugsnag","html_url":"https://github.com/bugsnag","followers_url":"https://api.github.com/users/bugsnag/followers","following_url":"https://api.github.com/users/bugsnag/following{/other_user}","gists_url":"https://api.github.com/users/bugsnag/gists{/gist_id}","starred_url":"https://api.github.com/users/bugsnag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugsnag/subscriptions","organizations_url":"https://api.github.com/users/bugsnag/orgs","repos_url":"https://api.github.com/users/bugsnag/repos","events_url":"https://api.github.com/users/bugsnag/events{/privacy}","received_events_url":"https://api.github.com/users/bugsnag/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bugsnag/bugsnag-js","description":"Javascript notifier for Bugsnag.","fork":false,"url":"https://api.github.com/repos/bugsnag/bugsnag-js","forks_url":"https://api.github.com/repos/bugsnag/bugsnag-js/forks","keys_url":"https://api.github.com/repos/bugsnag/bugsnag-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bugsnag/bugsnag-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bugsnag/bugsnag-js/teams","hooks_url":"https://api.github.com/repos/bugsnag/bugsnag-js/hooks","issue_events_url":"https://api.github.com/repos/bugsnag/bugsnag-js/issues/events{/number}","events_url":"https://api.github.com/repos/bugsnag/bugsnag-js/events","assignees_url":"https://api.github.com/repos/bugsnag/bugsnag-js/assignees{/user}","branches_url":"https://api.github.com/repos/bugsnag/bugsnag-js/branches{/branch}","tags_url":"https://api.github.com/repos/bugsnag/bugsnag-js/tags","blobs_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bugsnag/bugsnag-js/statuses/{sha}","languages_url":"https://api.github.com/repos/bugsnag/bugsnag-js/languages","stargazers_url":"https://api.github.com/repos/bugsnag/bugsnag-js/stargazers","contributors_url":"https://api.github.com/repos/bugsnag/bugsnag-js/contributors","subscribers_url":"https://api.github.com/repos/bugsnag/bugsnag-js/subscribers","subscription_url":"https://api.github.com/repos/bugsnag/bugsnag-js/subscription","commits_url":"https://api.github.com/repos/bugsnag/bugsnag-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/bugsnag/bugsnag-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/bugsnag/bugsnag-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/bugsnag/bugsnag-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/bugsnag/bugsnag-js/contents/{+path}","compare_url":"https://api.github.com/repos/bugsnag/bugsnag-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bugsnag/bugsnag-js/merges","archive_url":"https://api.github.com/repos/bugsnag/bugsnag-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bugsnag/bugsnag-js/downloads","issues_url":"https://api.github.com/repos/bugsnag/bugsnag-js/issues{/number}","pulls_url":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls{/number}","milestones_url":"https://api.github.com/repos/bugsnag/bugsnag-js/milestones{/number}","notifications_url":"https://api.github.com/repos/bugsnag/bugsnag-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bugsnag/bugsnag-js/labels{/name}","releases_url":"https://api.github.com/repos/bugsnag/bugsnag-js/releases{/id}","deployments_url":"https://api.github.com/repos/bugsnag/bugsnag-js/deployments","created_at":"2013-02-05T19:06:33Z","updated_at":"2016-07-07T10:39:26Z","pushed_at":"2016-07-07T19:07:09Z","git_url":"git://github.com/bugsnag/bugsnag-js.git","ssh_url":"git@github.com:bugsnag/bugsnag-js.git","clone_url":"https://github.com/bugsnag/bugsnag-js.git","svn_url":"https://github.com/bugsnag/bugsnag-js","homepage":"http://bugsnag.com/","size":746,"stargazers_count":180,"watchers_count":180,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":11,"forks":61,"open_issues":11,"watchers":180,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/149"},"html":{"href":"https://github.com/bugsnag/bugsnag-js/pull/149"},"issue":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/issues/149"},"comments":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/issues/149/comments"},"review_comments":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/149/comments"},"review_comment":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/pulls/149/commits"},"statuses":{"href":"https://api.github.com/repos/bugsnag/bugsnag-js/statuses/0f841fe74fd1db8f00ab2d09c91e79bae8412cdf"}}}}
{"actor":{"display_login":"eanakashima"}}