{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/1887","labels_url":"https://api.github.com/repos/babel/babel/issues/1887/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/1887/comments","events_url":"https://api.github.com/repos/babel/babel/issues/1887/events","html_url":"https://github.com/babel/babel/issues/1887","id":92374734,"number":1887,"title":"Arrow functions: lexical scope \"this\" not working","user":{"login":"Avien","id":4569044,"avatar_url":"https://avatars.githubusercontent.com/u/4569044?v=3","gravatar_id":"","url":"https://api.github.com/users/Avien","html_url":"https://github.com/Avien","followers_url":"https://api.github.com/users/Avien/followers","following_url":"https://api.github.com/users/Avien/following{/other_user}","gists_url":"https://api.github.com/users/Avien/gists{/gist_id}","starred_url":"https://api.github.com/users/Avien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Avien/subscriptions","organizations_url":"https://api.github.com/users/Avien/orgs","repos_url":"https://api.github.com/users/Avien/repos","events_url":"https://api.github.com/users/Avien/events{/privacy}","received_events_url":"https://api.github.com/users/Avien/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-01T12:54:14Z","updated_at":"2015-07-01T13:32:07Z","closed_at":"2015-07-01T13:11:39Z","body":"It seems the \"this\" scope refers to the global window and not to the relevant object\r\n\r\n```javascript\r\nexport class ToolBarService{\r\n\r\n    constructor(){\r\n        this.items = {\r\n            'exportTo': null\r\n        }\r\n    }\r\n\r\n    get export(){\r\n        return {\r\n            'onClick' : (handler)=>{\r\n                this.items.exportTo = handler;\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\nthis.items is undefined in the 'onClick' function\r\n\r\nImportant to say that the transpiled code in the bundle.js does seem to look correct:\r\n( I am using webpack babel-loader with babel-core 5.6.15)\r\n```javascript\r\n_createClass(ToolBarService,[{\r\n    key:'export',\r\n    get:function get(){\r\n        var _this = this;\r\n        \r\n        return {\r\n            'onClick' : function onClick(handler){\r\n                _this.items.exportTo = handler;\r\n            }\r\n        }\r\n    }\r\n}]);\r\n```\r\n\r\nBut it doesn't work\r\nHelp please\r\n10x"},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/117677453","html_url":"https://github.com/babel/babel/issues/1887#issuecomment-117677453","issue_url":"https://api.github.com/repos/babel/babel/issues/1887","id":117677453,"user":{"login":"sebmck","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/sebmck","html_url":"https://github.com/sebmck","followers_url":"https://api.github.com/users/sebmck/followers","following_url":"https://api.github.com/users/sebmck/following{/other_user}","gists_url":"https://api.github.com/users/sebmck/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmck/subscriptions","organizations_url":"https://api.github.com/users/sebmck/orgs","repos_url":"https://api.github.com/users/sebmck/repos","events_url":"https://api.github.com/users/sebmck/events{/privacy}","received_events_url":"https://api.github.com/users/sebmck/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T13:32:07Z","updated_at":"2015-07-01T13:32:07Z","body":"That's still not enough information. I don't know how you're interfacing with that method. Please provide a complete reproducible example."}}