{"action":"created","comment":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/73442247","id":73442247,"diff_hunk":"@@ -209,41 +212,33 @@ export class InstrumentationService {\n    * @param {!AnalyticsEventListenerDef} The callback to call when the event\n    *   occurs.\n    * @param {!JSONType} config Configuration for instrumentation.\n+   * @param {boolean} visibilityState State for which the callback is triggered.\n    * @private\n    */\n-  createVisibilityListener_(callback, config) {\n+  createVisibilityListener_(callback, config, visibilityState) {\n     if (config['visibilitySpec']) {\n       if (!isVisibilitySpecValid(config)) {\n         return;\n       }\n \n-      this.runOrSchedule_(() => {\n-        visibilityFor(this.win_).then(visibility => {\n-          visibility.listenOnce(config['visibilitySpec'], vars => {\n-            callback(new AnalyticsEvent(AnalyticsEventType.VISIBLE, vars));\n-          });\n-        });\n+      visibilityFor(this.win_).then(visibility => {\n+        visibility.listenOnce(config['visibilitySpec'], vars => {\n+          callback(new AnalyticsEvent(AnalyticsEventType.VISIBLE, vars));","path":"extensions/amp-analytics/0.1/instrumentation.js","position":null,"original_position":48,"commit_id":"36415aef4c44c84d57266e795fa1ad281f151ef0","original_commit_id":"535c842bd8f5d01660664e76a89007e3356f32e2","user":{"login":"avimehta","id":179359,"avatar_url":"https://avatars.githubusercontent.com/u/179359?v=3","gravatar_id":"","url":"https://api.github.com/users/avimehta","html_url":"https://github.com/avimehta","followers_url":"https://api.github.com/users/avimehta/followers","following_url":"https://api.github.com/users/avimehta/following{/other_user}","gists_url":"https://api.github.com/users/avimehta/gists{/gist_id}","starred_url":"https://api.github.com/users/avimehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avimehta/subscriptions","organizations_url":"https://api.github.com/users/avimehta/orgs","repos_url":"https://api.github.com/users/avimehta/repos","events_url":"https://api.github.com/users/avimehta/events{/privacy}","received_events_url":"https://api.github.com/users/avimehta/received_events","type":"User","site_admin":false},"body":"good catch. The event type is not used anywhere in the code. but it should have been different.","created_at":"2016-08-03T23:52:29Z","updated_at":"2016-08-03T23:52:29Z","html_url":"https://github.com/ampproject/amphtml/pull/4265#discussion_r73442247","pull_request_url":"https://api.github.com/repos/ampproject/amphtml/pulls/4265","_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/73442247"},"html":{"href":"https://github.com/ampproject/amphtml/pull/4265#discussion_r73442247"},"pull_request":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/4265"}}},"pull_request":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/4265","id":79293497,"html_url":"https://github.com/ampproject/amphtml/pull/4265","diff_url":"https://github.com/ampproject/amphtml/pull/4265.diff","patch_url":"https://github.com/ampproject/amphtml/pull/4265.patch","issue_url":"https://api.github.com/repos/ampproject/amphtml/issues/4265","number":4265,"state":"open","locked":false,"title":"Added support for a new trigger `on=hidden`.","user":{"login":"avimehta","id":179359,"avatar_url":"https://avatars.githubusercontent.com/u/179359?v=3","gravatar_id":"","url":"https://api.github.com/users/avimehta","html_url":"https://github.com/avimehta","followers_url":"https://api.github.com/users/avimehta/followers","following_url":"https://api.github.com/users/avimehta/following{/other_user}","gists_url":"https://api.github.com/users/avimehta/gists{/gist_id}","starred_url":"https://api.github.com/users/avimehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avimehta/subscriptions","organizations_url":"https://api.github.com/users/avimehta/orgs","repos_url":"https://api.github.com/users/avimehta/repos","events_url":"https://api.github.com/users/avimehta/events{/privacy}","received_events_url":"https://api.github.com/users/avimehta/received_events","type":"User","site_admin":false},"body":"The new trigger fires when the viewer is hidden. In addition,\r\nvisibilitySpec can be used to add additional conditions on when the\r\ntrigger fires.\r\n\r\nFixes #2487 #2564","created_at":"2016-07-29T01:15:51Z","updated_at":"2016-08-03T23:52:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a60d8eb8f64a783666919a9d6396cafd8f0ac33","assignee":{"login":"dvoytenko","id":726049,"avatar_url":"https://avatars.githubusercontent.com/u/726049?v=3","gravatar_id":"","url":"https://api.github.com/users/dvoytenko","html_url":"https://github.com/dvoytenko","followers_url":"https://api.github.com/users/dvoytenko/followers","following_url":"https://api.github.com/users/dvoytenko/following{/other_user}","gists_url":"https://api.github.com/users/dvoytenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dvoytenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvoytenko/subscriptions","organizations_url":"https://api.github.com/users/dvoytenko/orgs","repos_url":"https://api.github.com/users/dvoytenko/repos","events_url":"https://api.github.com/users/dvoytenko/events{/privacy}","received_events_url":"https://api.github.com/users/dvoytenko/received_events","type":"User","site_admin":false},"assignees":[{"login":"dvoytenko","id":726049,"avatar_url":"https://avatars.githubusercontent.com/u/726049?v=3","gravatar_id":"","url":"https://api.github.com/users/dvoytenko","html_url":"https://github.com/dvoytenko","followers_url":"https://api.github.com/users/dvoytenko/followers","following_url":"https://api.github.com/users/dvoytenko/following{/other_user}","gists_url":"https://api.github.com/users/dvoytenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dvoytenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvoytenko/subscriptions","organizations_url":"https://api.github.com/users/dvoytenko/orgs","repos_url":"https://api.github.com/users/dvoytenko/repos","events_url":"https://api.github.com/users/dvoytenko/events{/privacy}","received_events_url":"https://api.github.com/users/dvoytenko/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ampproject/amphtml/pulls/4265/commits","review_comments_url":"https://api.github.com/repos/ampproject/amphtml/pulls/4265/comments","review_comment_url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ampproject/amphtml/issues/4265/comments","statuses_url":"https://api.github.com/repos/ampproject/amphtml/statuses/36415aef4c44c84d57266e795fa1ad281f151ef0","head":{"label":"avimehta:unload","ref":"unload","sha":"36415aef4c44c84d57266e795fa1ad281f151ef0","user":{"login":"avimehta","id":179359,"avatar_url":"https://avatars.githubusercontent.com/u/179359?v=3","gravatar_id":"","url":"https://api.github.com/users/avimehta","html_url":"https://github.com/avimehta","followers_url":"https://api.github.com/users/avimehta/followers","following_url":"https://api.github.com/users/avimehta/following{/other_user}","gists_url":"https://api.github.com/users/avimehta/gists{/gist_id}","starred_url":"https://api.github.com/users/avimehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avimehta/subscriptions","organizations_url":"https://api.github.com/users/avimehta/orgs","repos_url":"https://api.github.com/users/avimehta/repos","events_url":"https://api.github.com/users/avimehta/events{/privacy}","received_events_url":"https://api.github.com/users/avimehta/received_events","type":"User","site_admin":false},"repo":{"id":44332738,"name":"amphtml","full_name":"avimehta/amphtml","owner":{"login":"avimehta","id":179359,"avatar_url":"https://avatars.githubusercontent.com/u/179359?v=3","gravatar_id":"","url":"https://api.github.com/users/avimehta","html_url":"https://github.com/avimehta","followers_url":"https://api.github.com/users/avimehta/followers","following_url":"https://api.github.com/users/avimehta/following{/other_user}","gists_url":"https://api.github.com/users/avimehta/gists{/gist_id}","starred_url":"https://api.github.com/users/avimehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avimehta/subscriptions","organizations_url":"https://api.github.com/users/avimehta/orgs","repos_url":"https://api.github.com/users/avimehta/repos","events_url":"https://api.github.com/users/avimehta/events{/privacy}","received_events_url":"https://api.github.com/users/avimehta/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/avimehta/amphtml","description":"AMP HTML source code, samples, and documentation.  See below for more info.","fork":true,"url":"https://api.github.com/repos/avimehta/amphtml","forks_url":"https://api.github.com/repos/avimehta/amphtml/forks","keys_url":"https://api.github.com/repos/avimehta/amphtml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avimehta/amphtml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avimehta/amphtml/teams","hooks_url":"https://api.github.com/repos/avimehta/amphtml/hooks","issue_events_url":"https://api.github.com/repos/avimehta/amphtml/issues/events{/number}","events_url":"https://api.github.com/repos/avimehta/amphtml/events","assignees_url":"https://api.github.com/repos/avimehta/amphtml/assignees{/user}","branches_url":"https://api.github.com/repos/avimehta/amphtml/branches{/branch}","tags_url":"https://api.github.com/repos/avimehta/amphtml/tags","blobs_url":"https://api.github.com/repos/avimehta/amphtml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avimehta/amphtml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avimehta/amphtml/git/refs{/sha}","trees_url":"https://api.github.com/repos/avimehta/amphtml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avimehta/amphtml/statuses/{sha}","languages_url":"https://api.github.com/repos/avimehta/amphtml/languages","stargazers_url":"https://api.github.com/repos/avimehta/amphtml/stargazers","contributors_url":"https://api.github.com/repos/avimehta/amphtml/contributors","subscribers_url":"https://api.github.com/repos/avimehta/amphtml/subscribers","subscription_url":"https://api.github.com/repos/avimehta/amphtml/subscription","commits_url":"https://api.github.com/repos/avimehta/amphtml/commits{/sha}","git_commits_url":"https://api.github.com/repos/avimehta/amphtml/git/commits{/sha}","comments_url":"https://api.github.com/repos/avimehta/amphtml/comments{/number}","issue_comment_url":"https://api.github.com/repos/avimehta/amphtml/issues/comments{/number}","contents_url":"https://api.github.com/repos/avimehta/amphtml/contents/{+path}","compare_url":"https://api.github.com/repos/avimehta/amphtml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avimehta/amphtml/merges","archive_url":"https://api.github.com/repos/avimehta/amphtml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avimehta/amphtml/downloads","issues_url":"https://api.github.com/repos/avimehta/amphtml/issues{/number}","pulls_url":"https://api.github.com/repos/avimehta/amphtml/pulls{/number}","milestones_url":"https://api.github.com/repos/avimehta/amphtml/milestones{/number}","notifications_url":"https://api.github.com/repos/avimehta/amphtml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avimehta/amphtml/labels{/name}","releases_url":"https://api.github.com/repos/avimehta/amphtml/releases{/id}","deployments_url":"https://api.github.com/repos/avimehta/amphtml/deployments","created_at":"2015-10-15T17:06:23Z","updated_at":"2016-01-11T23:25:41Z","pushed_at":"2016-08-03T23:51:11Z","git_url":"git://github.com/avimehta/amphtml.git","ssh_url":"git@github.com:avimehta/amphtml.git","clone_url":"https://github.com/avimehta/amphtml.git","svn_url":"https://github.com/avimehta/amphtml","homepage":"https://ampproject.org","size":127702,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"ampproject:master","ref":"master","sha":"05fe61bbb587e3fc2462a4503541d7e2ff42e6cb","user":{"login":"ampproject","id":14114390,"avatar_url":"https://avatars.githubusercontent.com/u/14114390?v=3","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"repo":{"id":41766002,"name":"amphtml","full_name":"ampproject/amphtml","owner":{"login":"ampproject","id":14114390,"avatar_url":"https://avatars.githubusercontent.com/u/14114390?v=3","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ampproject/amphtml","description":"AMP HTML source code, samples, and documentation.  See below for more info.","fork":false,"url":"https://api.github.com/repos/ampproject/amphtml","forks_url":"https://api.github.com/repos/ampproject/amphtml/forks","keys_url":"https://api.github.com/repos/ampproject/amphtml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ampproject/amphtml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ampproject/amphtml/teams","hooks_url":"https://api.github.com/repos/ampproject/amphtml/hooks","issue_events_url":"https://api.github.com/repos/ampproject/amphtml/issues/events{/number}","events_url":"https://api.github.com/repos/ampproject/amphtml/events","assignees_url":"https://api.github.com/repos/ampproject/amphtml/assignees{/user}","branches_url":"https://api.github.com/repos/ampproject/amphtml/branches{/branch}","tags_url":"https://api.github.com/repos/ampproject/amphtml/tags","blobs_url":"https://api.github.com/repos/ampproject/amphtml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ampproject/amphtml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ampproject/amphtml/git/refs{/sha}","trees_url":"https://api.github.com/repos/ampproject/amphtml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ampproject/amphtml/statuses/{sha}","languages_url":"https://api.github.com/repos/ampproject/amphtml/languages","stargazers_url":"https://api.github.com/repos/ampproject/amphtml/stargazers","contributors_url":"https://api.github.com/repos/ampproject/amphtml/contributors","subscribers_url":"https://api.github.com/repos/ampproject/amphtml/subscribers","subscription_url":"https://api.github.com/repos/ampproject/amphtml/subscription","commits_url":"https://api.github.com/repos/ampproject/amphtml/commits{/sha}","git_commits_url":"https://api.github.com/repos/ampproject/amphtml/git/commits{/sha}","comments_url":"https://api.github.com/repos/ampproject/amphtml/comments{/number}","issue_comment_url":"https://api.github.com/repos/ampproject/amphtml/issues/comments{/number}","contents_url":"https://api.github.com/repos/ampproject/amphtml/contents/{+path}","compare_url":"https://api.github.com/repos/ampproject/amphtml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ampproject/amphtml/merges","archive_url":"https://api.github.com/repos/ampproject/amphtml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ampproject/amphtml/downloads","issues_url":"https://api.github.com/repos/ampproject/amphtml/issues{/number}","pulls_url":"https://api.github.com/repos/ampproject/amphtml/pulls{/number}","milestones_url":"https://api.github.com/repos/ampproject/amphtml/milestones{/number}","notifications_url":"https://api.github.com/repos/ampproject/amphtml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ampproject/amphtml/labels{/name}","releases_url":"https://api.github.com/repos/ampproject/amphtml/releases{/id}","deployments_url":"https://api.github.com/repos/ampproject/amphtml/deployments","created_at":"2015-09-01T22:10:53Z","updated_at":"2016-08-03T23:13:24Z","pushed_at":"2016-08-03T23:51:11Z","git_url":"git://github.com/ampproject/amphtml.git","ssh_url":"git@github.com:ampproject/amphtml.git","clone_url":"https://github.com/ampproject/amphtml.git","svn_url":"https://github.com/ampproject/amphtml","homepage":"https://ampproject.org","size":141108,"stargazers_count":8065,"watchers_count":8065,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1162,"mirror_url":null,"open_issues_count":661,"forks":1162,"open_issues":661,"watchers":8065,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/4265"},"html":{"href":"https://github.com/ampproject/amphtml/pull/4265"},"issue":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/4265"},"comments":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/4265/comments"},"review_comments":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/4265/comments"},"review_comment":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/4265/commits"},"statuses":{"href":"https://api.github.com/repos/ampproject/amphtml/statuses/36415aef4c44c84d57266e795fa1ad281f151ef0"}}}}
{"actor":{"display_login":"avimehta"}}