{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/7287","repository_url":"https://api.github.com/repos/mozilla/pdf.js","labels_url":"https://api.github.com/repos/mozilla/pdf.js/issues/7287/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/issues/7287/comments","events_url":"https://api.github.com/repos/mozilla/pdf.js/issues/7287/events","html_url":"https://github.com/mozilla/pdf.js/issues/7287","id":152828031,"number":7287,"title":"pdf.js doesn't work with requirejs","user":{"login":"MartinSnyder","id":1706711,"avatar_url":"https://avatars.githubusercontent.com/u/1706711?v=3","gravatar_id":"","url":"https://api.github.com/users/MartinSnyder","html_url":"https://github.com/MartinSnyder","followers_url":"https://api.github.com/users/MartinSnyder/followers","following_url":"https://api.github.com/users/MartinSnyder/following{/other_user}","gists_url":"https://api.github.com/users/MartinSnyder/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinSnyder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinSnyder/subscriptions","organizations_url":"https://api.github.com/users/MartinSnyder/orgs","repos_url":"https://api.github.com/users/MartinSnyder/repos","events_url":"https://api.github.com/users/MartinSnyder/events{/privacy}","received_events_url":"https://api.github.com/users/MartinSnyder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-03T17:17:18Z","updated_at":"2016-05-03T18:00:14Z","closed_at":null,"body":"The following HTML demonstrates the issue:\r\n```<html>\r\n<head>\r\n    <title>Flexpaper React/Require Sandbox</title>\r\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.js\"></script>\r\n    <script>\r\n        require(['pdf'], function(pdf) {\r\n            console.log('PDFJS Module: ' + pdf);\r\n            console.log('PDFJS Global: ' + window.PDFJS);\r\n        });\r\n    </script>\r\n</head>\r\n</html>\r\n```\r\n\r\npdf.js, detects the existence of the \"require\" and \"define\" functions and accordingly does NOT set the global PDFJS instance.  However, it also does not return a reference to that instance through the module loader.\r\n\r\nBecause both \"pdf\" and \"window.PDFJS\" are undefined in the example above, the library cannot be used in applications that use require.  This is the case regardless of whether or not require is used to load pdf.js.\r\n\r\nNote that this works correctly with version 1.0.1040 but fails with 1.4.20 and 1.5.188.  I did not test with versions other than those 3.  The behavior was consistent in all three versions between Chrome and Safari."},"comment":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/comments/216613126","html_url":"https://github.com/mozilla/pdf.js/issues/7287#issuecomment-216613126","issue_url":"https://api.github.com/repos/mozilla/pdf.js/issues/7287","id":216613126,"user":{"login":"MartinSnyder","id":1706711,"avatar_url":"https://avatars.githubusercontent.com/u/1706711?v=3","gravatar_id":"","url":"https://api.github.com/users/MartinSnyder","html_url":"https://github.com/MartinSnyder","followers_url":"https://api.github.com/users/MartinSnyder/followers","following_url":"https://api.github.com/users/MartinSnyder/following{/other_user}","gists_url":"https://api.github.com/users/MartinSnyder/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinSnyder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinSnyder/subscriptions","organizations_url":"https://api.github.com/users/MartinSnyder/orgs","repos_url":"https://api.github.com/users/MartinSnyder/repos","events_url":"https://api.github.com/users/MartinSnyder/events{/privacy}","received_events_url":"https://api.github.com/users/MartinSnyder/received_events","type":"User","site_admin":false},"created_at":"2016-05-03T18:00:14Z","updated_at":"2016-05-03T18:00:14Z","body":"Sure, I'll setup a Github repo to demonstrate more fully."}}