{"action":"created","issue":{"url":"https://api.github.com/repos/curran/d3-component/issues/70","repository_url":"https://api.github.com/repos/curran/d3-component","labels_url":"https://api.github.com/repos/curran/d3-component/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/curran/d3-component/issues/70/comments","events_url":"https://api.github.com/repos/curran/d3-component/issues/70/events","html_url":"https://github.com/curran/d3-component/issues/70","id":215356477,"number":70,"title":"ES6 Considerations","user":{"login":"curran","id":68416,"avatar_url":"https://avatars0.githubusercontent.com/u/68416?v=3","gravatar_id":"","url":"https://api.github.com/users/curran","html_url":"https://github.com/curran","followers_url":"https://api.github.com/users/curran/followers","following_url":"https://api.github.com/users/curran/following{/other_user}","gists_url":"https://api.github.com/users/curran/gists{/gist_id}","starred_url":"https://api.github.com/users/curran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curran/subscriptions","organizations_url":"https://api.github.com/users/curran/orgs","repos_url":"https://api.github.com/users/curran/repos","events_url":"https://api.github.com/users/curran/events{/privacy}","received_events_url":"https://api.github.com/users/curran/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-03-20T08:43:40Z","updated_at":"2017-03-24T14:54:54Z","closed_at":null,"body":"Using d3-component is awkward with ES6, because the API relies heavily on use of non-lexically-bound `this`. For the next major version of d3-component, I'd like to make the API more ES6-friendly.\r\n\r\nThe decision for the original API was intentional, to mirror the API of D3's *selection*.each. However, it's unfortunate because we can't use ES6 arrow functions.\r\n\r\nES5:\r\n```js\r\nvar paragraph = d3.component(\"p\")\r\n  .render(function (d){\r\n    d3.select(this).text(d);\r\n  }),\r\n```\r\n\r\nES6 (ideal):\r\n```js\r\nconst paragraph = d3.component(\"p\")\r\n  .render((d) => d3.select(this).text(d)); // Breaks due to lexically bound \"this\"\r\n```\r\n\r\nMaybe we could pass in a selection:\r\n\r\nES6 (idea):\r\n```js\r\nconst paragraph = d3.component(\"p\")\r\n  .render((selection, d) => selection.text(d)); // Would work fine.\r\n```\r\n\r\n/cc @micahstubbs"},"comment":{"url":"https://api.github.com/repos/curran/d3-component/issues/comments/289045372","html_url":"https://github.com/curran/d3-component/issues/70#issuecomment-289045372","issue_url":"https://api.github.com/repos/curran/d3-component/issues/70","id":289045372,"user":{"login":"micahstubbs","id":2119400,"avatar_url":"https://avatars0.githubusercontent.com/u/2119400?v=3","gravatar_id":"","url":"https://api.github.com/users/micahstubbs","html_url":"https://github.com/micahstubbs","followers_url":"https://api.github.com/users/micahstubbs/followers","following_url":"https://api.github.com/users/micahstubbs/following{/other_user}","gists_url":"https://api.github.com/users/micahstubbs/gists{/gist_id}","starred_url":"https://api.github.com/users/micahstubbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micahstubbs/subscriptions","organizations_url":"https://api.github.com/users/micahstubbs/orgs","repos_url":"https://api.github.com/users/micahstubbs/repos","events_url":"https://api.github.com/users/micahstubbs/events{/privacy}","received_events_url":"https://api.github.com/users/micahstubbs/received_events","type":"User","site_admin":false},"created_at":"2017-03-24T14:54:54Z","updated_at":"2017-03-24T14:54:54Z","body":"@curran don't have strong feelings about this. my intuition is that it would it remove a special case a user of d3-component has to remember, and that would be positive ☺ "}}
{"actor":{"display_login":"micahstubbs"}}