{"action":"created","issue":{"url":"https://api.github.com/repos/kenwheeler/mcfly/issues/37","labels_url":"https://api.github.com/repos/kenwheeler/mcfly/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/kenwheeler/mcfly/issues/37/comments","events_url":"https://api.github.com/repos/kenwheeler/mcfly/issues/37/events","html_url":"https://github.com/kenwheeler/mcfly/issues/37","id":58931922,"number":37,"title":"Swap promises for ES6 generators and ES7 async await","user":{"login":"tomatau","id":1243486,"avatar_url":"https://avatars.githubusercontent.com/u/1243486?v=3","gravatar_id":"","url":"https://api.github.com/users/tomatau","html_url":"https://github.com/tomatau","followers_url":"https://api.github.com/users/tomatau/followers","following_url":"https://api.github.com/users/tomatau/following{/other_user}","gists_url":"https://api.github.com/users/tomatau/gists{/gist_id}","starred_url":"https://api.github.com/users/tomatau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomatau/subscriptions","organizations_url":"https://api.github.com/users/tomatau/orgs","repos_url":"https://api.github.com/users/tomatau/repos","events_url":"https://api.github.com/users/tomatau/events{/privacy}","received_events_url":"https://api.github.com/users/tomatau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-02-25T16:52:28Z","updated_at":"2015-02-25T21:06:21Z","closed_at":null,"body":"I feel this would greatly improve the API usage and also improve error handling - making the code much clear to avoid things like the dirty `reThrow` function that lives inside Action.\r\n\r\nThis would require using the babel compiler (6to5) which also supports JSX if mcfly ever goes the route of involving any JSX.\r\n\r\ne.g. Currently:\r\n```\r\nlet MyActions = mcfly.createActions({\r\n  actionCreator(foo){\r\n    let scopedVar;\r\n    return asyncCall.method(foo)\r\n      .then(resolved=>{\r\n        scopedVar = resolved.bar;\r\n        return asyncCall.anotherMethod(resolved.derp);\r\n      })\r\n      .then(resolved2=>({\r\n        actionType: Constants.EVENT,\r\n        scopedVar, resolved2\r\n      }))\r\n  }\r\n```\r\n\r\nWould become, something like this (maybe?):\r\n```\r\nlet MyActions = mcfly.createActions({\r\n  actionCreator(foo){\r\n    let resolved = await asyncCall.method(foo)\r\n    let scopedVar = resolved.bar;\r\n    let resolved2 = await asyncCall.anotherMethod(resolved.derp)\r\n    return {\r\n      actionType: Constants.EVENT,\r\n      scopedVar, resolved2\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nWhich reads much nicer imo and is forward thinking.\r\n\r\nIt would also help with https://github.com/kenwheeler/mcfly/issues/36"},"comment":{"url":"https://api.github.com/repos/kenwheeler/mcfly/issues/comments/76057963","html_url":"https://github.com/kenwheeler/mcfly/issues/37#issuecomment-76057963","issue_url":"https://api.github.com/repos/kenwheeler/mcfly/issues/37","id":76057963,"user":{"login":"kenwheeler","id":286616,"avatar_url":"https://avatars.githubusercontent.com/u/286616?v=3","gravatar_id":"","url":"https://api.github.com/users/kenwheeler","html_url":"https://github.com/kenwheeler","followers_url":"https://api.github.com/users/kenwheeler/followers","following_url":"https://api.github.com/users/kenwheeler/following{/other_user}","gists_url":"https://api.github.com/users/kenwheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/kenwheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenwheeler/subscriptions","organizations_url":"https://api.github.com/users/kenwheeler/orgs","repos_url":"https://api.github.com/users/kenwheeler/repos","events_url":"https://api.github.com/users/kenwheeler/events{/privacy}","received_events_url":"https://api.github.com/users/kenwheeler/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T21:06:21Z","updated_at":"2015-02-25T21:06:21Z","body":"With the above example, MyActions.getPost(param) would still work, async being a special property that doesn't call dispatch implicitly."}}