{"action":"created","issue":{"url":"https://api.github.com/repos/rollup/rollup/issues/707","repository_url":"https://api.github.com/repos/rollup/rollup","labels_url":"https://api.github.com/repos/rollup/rollup/issues/707/labels{/name}","comments_url":"https://api.github.com/repos/rollup/rollup/issues/707/comments","events_url":"https://api.github.com/repos/rollup/rollup/issues/707/events","html_url":"https://github.com/rollup/rollup/pull/707","id":159511046,"number":707,"title":"rewrite top-level this as undefined","user":{"login":"Rich-Harris","id":1162160,"avatar_url":"https://avatars.githubusercontent.com/u/1162160?v=3","gravatar_id":"","url":"https://api.github.com/users/Rich-Harris","html_url":"https://github.com/Rich-Harris","followers_url":"https://api.github.com/users/Rich-Harris/followers","following_url":"https://api.github.com/users/Rich-Harris/following{/other_user}","gists_url":"https://api.github.com/users/Rich-Harris/gists{/gist_id}","starred_url":"https://api.github.com/users/Rich-Harris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rich-Harris/subscriptions","organizations_url":"https://api.github.com/users/Rich-Harris/orgs","repos_url":"https://api.github.com/users/Rich-Harris/repos","events_url":"https://api.github.com/users/Rich-Harris/events{/privacy}","received_events_url":"https://api.github.com/users/Rich-Harris/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-09T21:21:04Z","updated_at":"2016-07-24T04:42:51Z","closed_at":"2016-06-10T21:33:28Z","pull_request":{"url":"https://api.github.com/repos/rollup/rollup/pulls/707","html_url":"https://github.com/rollup/rollup/pull/707","diff_url":"https://github.com/rollup/rollup/pull/707.diff","patch_url":"https://github.com/rollup/rollup/pull/707.patch"},"body":"We didn't catch that this wasn't already happening (pretty sure it did at one point), because Babel was doing it for us in the test (and we needed Babel, because we need to test behaviour inside arrow functions...)"},"comment":{"url":"https://api.github.com/repos/rollup/rollup/issues/comments/234757367","html_url":"https://github.com/rollup/rollup/pull/707#issuecomment-234757367","issue_url":"https://api.github.com/repos/rollup/rollup/issues/707","id":234757367,"user":{"login":"cognitom","id":16032,"avatar_url":"https://avatars.githubusercontent.com/u/16032?v=3","gravatar_id":"","url":"https://api.github.com/users/cognitom","html_url":"https://github.com/cognitom","followers_url":"https://api.github.com/users/cognitom/followers","following_url":"https://api.github.com/users/cognitom/following{/other_user}","gists_url":"https://api.github.com/users/cognitom/gists{/gist_id}","starred_url":"https://api.github.com/users/cognitom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cognitom/subscriptions","organizations_url":"https://api.github.com/users/cognitom/orgs","repos_url":"https://api.github.com/users/cognitom/repos","events_url":"https://api.github.com/users/cognitom/events{/privacy}","received_events_url":"https://api.github.com/users/cognitom/received_events","type":"User","site_admin":false},"created_at":"2016-07-24T04:42:51Z","updated_at":"2016-07-24T04:42:51Z","body":"To bundle the code for non-Node environments, sometimes `this` is needed on top-level. For someone like me, this is a simple workaround for it, kind of:\r\n\r\n```javascript\r\ndoSomething(that)\r\n```\r\n\r\nAdd [intro option](https://github.com/rollup/rollup/wiki/JavaScript-API#introoutro):\r\n\r\n```javascript\r\nconst code = bundle.generate({\r\n  intro: 'const that = this'\r\n}).code;\r\n```\r\n\r\nThen the output:\r\n\r\n```javascript\r\nconst that = this\r\ndoSomething(that)\r\n```"}}
{"actor":{"display_login":"cognitom"}}