{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/frontend/pulls/comments/93401914","pull_request_review_id":13927205,"id":93401914,"diff_hunk":"@@ -60,84 +60,90 @@ define([\n     function init(moduleName) {\n         performanceLogging.moduleStart(moduleName);\n \n-        require(['bootstraps/enhanced/media/main'], function() {\n-            require(['bootstraps/enhanced/media/video-player'], function (videojs) {\n-                var $videoEl = $('.vjs-hosted__video');\n-                var $inlineVideoEl = $('video');\n-                var $youtubeIframe = $('.js-hosted-youtube-video');\n-\n-                if ($youtubeIframe.length === 0 && $videoEl.length === 0) {\n-                    if ($inlineVideoEl.length === 0) {\n-                        // halt execution\n-                        return;\n-                    } else {\n-                        $videoEl = $inlineVideoEl;\n-                    }\n-                }\n-\n-                $videoEl.each(function(el){\n-                    var mediaId = $videoEl.attr('data-media-id');\n-                    player = videojs(el, videojsOptions());\n-                    player.guMediaType = 'video';\n-                    videojs.plugin('fullscreener', fullscreener);\n-\n-                    events.addContentEvents(player, mediaId, player.guMediaType);\n-                    events.bindGoogleAnalyticsEvents(player, window.location.pathname);\n-\n-                    player.ready(function () {\n-                        var vol;\n-                        var player = this;\n-                        initLoadingSpinner(player);\n-                        upgradeVideoPlayerAccessibility(player);\n-\n-                        // unglitching the volume on first load\n-                        vol = player.volume();\n-                        if (vol) {\n-                            player.volume(0);\n-                            player.volume(vol);\n+        // Return a promise that resolves after the async work is done.\n+        var enhanceVideo = new Promise(function(resolve){\n+\n+            require(['bootstraps/enhanced/media/main'], function() {\n+                require(['bootstraps/enhanced/media/video-player'], function (videojs) {\n+                    var $videoEl = $('.vjs-hosted__video');\n+                    var $inlineVideoEl = $('video');\n+                    var $youtubeIframe = $('.js-hosted-youtube-video');\n+\n+                    if ($youtubeIframe.length === 0 && $videoEl.length === 0) {\n+                        if ($inlineVideoEl.length === 0) {\n+                            // halt execution\n+                            performanceLogging.moduleEnd(moduleName);\n+                            resolve();","path":"static/src/javascripts/projects/commercial/modules/hosted/video.js","position":52,"original_position":52,"commit_id":"46eb2fdaa587af1615e4923a5961d6fc35a2b9cd","original_commit_id":"adef3f49a1e443546886bbb25d05f05e36523ad5","user":{"login":"rich-nguyen","id":4549425,"avatar_url":"https://avatars.githubusercontent.com/u/4549425?v=3","gravatar_id":"","url":"https://api.github.com/users/rich-nguyen","html_url":"https://github.com/rich-nguyen","followers_url":"https://api.github.com/users/rich-nguyen/followers","following_url":"https://api.github.com/users/rich-nguyen/following{/other_user}","gists_url":"https://api.github.com/users/rich-nguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/rich-nguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rich-nguyen/subscriptions","organizations_url":"https://api.github.com/users/rich-nguyen/orgs","repos_url":"https://api.github.com/users/rich-nguyen/repos","events_url":"https://api.github.com/users/rich-nguyen/events{/privacy}","received_events_url":"https://api.github.com/users/rich-nguyen/received_events","type":"User","site_admin":false},"body":"👍 ","created_at":"2016-12-21T09:26:42Z","updated_at":"2016-12-21T09:26:42Z","html_url":"https://github.com/guardian/frontend/pull/15411#discussion_r93401914","pull_request_url":"https://api.github.com/repos/guardian/frontend/pulls/15411","_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments/93401914"},"html":{"href":"https://github.com/guardian/frontend/pull/15411#discussion_r93401914"},"pull_request":{"href":"https://api.github.com/repos/guardian/frontend/pulls/15411"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/frontend/pulls/15411","id":98892301,"html_url":"https://github.com/guardian/frontend/pull/15411","diff_url":"https://github.com/guardian/frontend/pull/15411.diff","patch_url":"https://github.com/guardian/frontend/pull/15411.patch","issue_url":"https://api.github.com/repos/guardian/frontend/issues/15411","number":15411,"state":"open","locked":false,"title":"Add performance timing logging to Hosted js modules","user":{"login":"rich-nguyen","id":4549425,"avatar_url":"https://avatars.githubusercontent.com/u/4549425?v=3","gravatar_id":"","url":"https://api.github.com/users/rich-nguyen","html_url":"https://github.com/rich-nguyen","followers_url":"https://api.github.com/users/rich-nguyen/followers","following_url":"https://api.github.com/users/rich-nguyen/following{/other_user}","gists_url":"https://api.github.com/users/rich-nguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/rich-nguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rich-nguyen/subscriptions","organizations_url":"https://api.github.com/users/rich-nguyen/orgs","repos_url":"https://api.github.com/users/rich-nguyen/repos","events_url":"https://api.github.com/users/rich-nguyen/events{/privacy}","received_events_url":"https://api.github.com/users/rich-nguyen/received_events","type":"User","site_admin":false},"body":"This alters the commercial bootstrap behaviour for all commercial modules which use custom timing. These modules all share the same pattern; they use custom timing to measure their execution time because the work they do is done asynchronously (usually through the gpt command buffer), and, crucially, this asynchronous work does _not_ need to be waited for in order for execution of dependent modules to begin.\r\n\r\nAnother way to think of this is that these modules add work to the queue, and the act of adding it to the queue is the only part of the module that must be completed by the bootstrap. The queued work itself is ordered, and safe to execute outside of the bootstrap's promise handling.\r\n\r\nSo, the promise that encloses this kind of async work only serves to tell the bootstrap that the module has fully completed, and this information is *only useful in the context of hosted modules, whose pages have no MPUs, which causes the performance logging POST to be skipped.\r\n\r\n(*only - there are some other situations we could consider in the future. Any page which has no MPUs served through DFP will not be performance logged). ","created_at":"2016-12-21T08:42:57Z","updated_at":"2016-12-21T09:26:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a232027be90a3a9aaa0424f13d4cd4d44ba2794d","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/guardian/frontend/milestones/2","html_url":"https://github.com/guardian/frontend/milestone/2","labels_url":"https://api.github.com/repos/guardian/frontend/milestones/2/labels","id":2043531,"number":2,"title":"Commercial Team Q3 2016","description":"","creator":{"login":"regiskuckaertz","id":629976,"avatar_url":"https://avatars.githubusercontent.com/u/629976?v=3","gravatar_id":"","url":"https://api.github.com/users/regiskuckaertz","html_url":"https://github.com/regiskuckaertz","followers_url":"https://api.github.com/users/regiskuckaertz/followers","following_url":"https://api.github.com/users/regiskuckaertz/following{/other_user}","gists_url":"https://api.github.com/users/regiskuckaertz/gists{/gist_id}","starred_url":"https://api.github.com/users/regiskuckaertz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/regiskuckaertz/subscriptions","organizations_url":"https://api.github.com/users/regiskuckaertz/orgs","repos_url":"https://api.github.com/users/regiskuckaertz/repos","events_url":"https://api.github.com/users/regiskuckaertz/events{/privacy}","received_events_url":"https://api.github.com/users/regiskuckaertz/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":104,"state":"open","created_at":"2016-10-03T09:06:38Z","updated_at":"2016-12-21T08:42:57Z","due_on":"2016-12-30T08:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/guardian/frontend/pulls/15411/commits","review_comments_url":"https://api.github.com/repos/guardian/frontend/pulls/15411/comments","review_comment_url":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/frontend/issues/15411/comments","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/46eb2fdaa587af1615e4923a5961d6fc35a2b9cd","head":{"label":"guardian:log-hosted-js-modules","ref":"log-hosted-js-modules","sha":"46eb2fdaa587af1615e4923a5961d6fc35a2b9cd","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":4370755,"name":"frontend","full_name":"guardian/frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/frontend/deployments","created_at":"2012-05-18T15:39:15Z","updated_at":"2016-12-21T05:57:21Z","pushed_at":"2016-12-21T09:17:17Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"http://www.theguardian.com","size":494206,"stargazers_count":3450,"watchers_count":3450,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":366,"mirror_url":null,"open_issues_count":52,"forks":366,"open_issues":52,"watchers":3450,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"457552a877217ef66e28d5853e32e7215b84c215","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":4370755,"name":"frontend","full_name":"guardian/frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/frontend/deployments","created_at":"2012-05-18T15:39:15Z","updated_at":"2016-12-21T05:57:21Z","pushed_at":"2016-12-21T09:17:17Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"http://www.theguardian.com","size":494206,"stargazers_count":3450,"watchers_count":3450,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":366,"mirror_url":null,"open_issues_count":52,"forks":366,"open_issues":52,"watchers":3450,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/15411"},"html":{"href":"https://github.com/guardian/frontend/pull/15411"},"issue":{"href":"https://api.github.com/repos/guardian/frontend/issues/15411"},"comments":{"href":"https://api.github.com/repos/guardian/frontend/issues/15411/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/frontend/pulls/15411/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/frontend/pulls/15411/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/frontend/statuses/46eb2fdaa587af1615e4923a5961d6fc35a2b9cd"}}}}
{"actor":{"display_login":"rich-nguyen"}}