{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/7886","repository_url":"https://api.github.com/repos/mozilla/pdf.js","labels_url":"https://api.github.com/repos/mozilla/pdf.js/issues/7886/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/issues/7886/comments","events_url":"https://api.github.com/repos/mozilla/pdf.js/issues/7886/events","html_url":"https://github.com/mozilla/pdf.js/pull/7886","id":194538555,"number":7886,"title":"Move the `Preferences` initialization/fetching code to the top of `PDFViewerApplication.initialize`, to enable using them when initializing e.g. the viewer components","user":{"login":"Snuffleupagus","id":2692120,"avatar_url":"https://avatars.githubusercontent.com/u/2692120?v=3","gravatar_id":"","url":"https://api.github.com/users/Snuffleupagus","html_url":"https://github.com/Snuffleupagus","followers_url":"https://api.github.com/users/Snuffleupagus/followers","following_url":"https://api.github.com/users/Snuffleupagus/following{/other_user}","gists_url":"https://api.github.com/users/Snuffleupagus/gists{/gist_id}","starred_url":"https://api.github.com/users/Snuffleupagus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Snuffleupagus/subscriptions","organizations_url":"https://api.github.com/users/Snuffleupagus/orgs","repos_url":"https://api.github.com/users/Snuffleupagus/repos","events_url":"https://api.github.com/users/Snuffleupagus/events{/privacy}","received_events_url":"https://api.github.com/users/Snuffleupagus/received_events","type":"User","site_admin":false},"labels":[{"id":164429,"url":"https://api.github.com/repos/mozilla/pdf.js/labels/1-viewer","name":"1-viewer","color":"DDDDDD","default":false}],"state":"open","locked":false,"assignee":{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false},"assignees":[{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2016-12-09T08:24:30Z","updated_at":"2016-12-13T12:08:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mozilla/pdf.js/pulls/7886","html_url":"https://github.com/mozilla/pdf.js/pull/7886","diff_url":"https://github.com/mozilla/pdf.js/pull/7886.diff","patch_url":"https://github.com/mozilla/pdf.js/pull/7886.patch"},"body":"*This is a new attempt at implementing, the main feature of, PR #7586. With the changes made to the 'localized' event in PR #7789, and the first commits here, this should avoid the issues with the Firefox addon that caused the previous PR to be backed out; see https://github.com/mozilla/pdf.js/pull/7586#issuecomment-244561590.*\r\n\r\nI'd suggest looking at one commit at a time, and using the `?w=1` flag should help reduce (or at least simplify) the larger diffs somewhat. Please also note that GitHub may list the commits in a sub-optimal order, according to date, but they should be reviewed as follows:\r\n\r\n- Refactor `PDFViewerApplication.initialize` into two methods, one that reads the Preferences and one that initializes the various viewer components\r\n\r\n - Move the `Preferences` initialization/fetching code to the top of `PDFViewerApplication.initialize`, to enable using them when initializing e.g. the viewer components\r\n   > Note that in quick testing using `console.time/timeEnd`, both locally and with the Firefox addon, the total run time of the *entire* `PDFViewerApplication.initialize` function does not seem to change with this patch.\r\n\r\n - Don't call `bindEvents()` until `PDFViewerApplication` has been initialized, and move binding of `window` event listeners to a helper method, to prevent errors if an event manages to arrive too soon\r\n   > With `bindEvents()` now being called after the viewer has been initialized, we no longer need to have `PDFViewerApplication.initialized` checks in the event handler functions.\r\nFurthermore by moving the `window.addEventListener`s to a helper method, `PDFViewerApplication.initialized` checks are no longer necessary in the event handlers, hence we thus address part of issue #7797 here as well.\r\n\r\n - Convert the only remaining consumer (in `hand_tool.js`) of the 'localized' event to use the `localized` Promise instead, and only re-dispatch the 'localized' event on the `eventBus` for `GENERIC` builds\r\n   > Ideally we'd remove the 'localized' event from the `eventBus`, but for backwards compatibility we keep it in `GENERIC` builds.\r\nNote that while we want to ensure that the direction attribute of the HTML is updated as soon as the `localized` Promise is resolved, we purposely wait until the viewer has been initialized to ensure that the 'localized' event will always be dispatched.\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/mozilla/pdf.js/7886)\r\n<!-- Reviewable:end -->\r\n"},"comment":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/comments/266722497","html_url":"https://github.com/mozilla/pdf.js/pull/7886#issuecomment-266722497","issue_url":"https://api.github.com/repos/mozilla/pdf.js/issues/7886","id":266722497,"user":{"login":"pdfjsbot","id":1036361,"avatar_url":"https://avatars.githubusercontent.com/u/1036361?v=3","gravatar_id":"","url":"https://api.github.com/users/pdfjsbot","html_url":"https://github.com/pdfjsbot","followers_url":"https://api.github.com/users/pdfjsbot/followers","following_url":"https://api.github.com/users/pdfjsbot/following{/other_user}","gists_url":"https://api.github.com/users/pdfjsbot/gists{/gist_id}","starred_url":"https://api.github.com/users/pdfjsbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdfjsbot/subscriptions","organizations_url":"https://api.github.com/users/pdfjsbot/orgs","repos_url":"https://api.github.com/users/pdfjsbot/repos","events_url":"https://api.github.com/users/pdfjsbot/events{/privacy}","received_events_url":"https://api.github.com/users/pdfjsbot/received_events","type":"User","site_admin":false},"created_at":"2016-12-13T12:08:13Z","updated_at":"2016-12-13T12:08:13Z","body":"#### From: Bot.io (Windows)\n\n----\n\n# Success\n\nFull output at http://107.22.172.223:8877/02730e8a742eeb1/output.txt\n\nTotal script time: 3.35 mins\n\n#### Published\n\n+ Viewer: http://107.22.172.223:8877/02730e8a742eeb1/web/viewer.html\n+ Extension: http://107.22.172.223:8877/02730e8a742eeb1/extensions/firefox/pdf.js.xpi"}}
{"actor":{"display_login":"pdfjsbot"}}