{"action":"created","issue":{"url":"https://api.github.com/repos/goatslacker/alt/issues/49","labels_url":"https://api.github.com/repos/goatslacker/alt/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/goatslacker/alt/issues/49/comments","events_url":"https://api.github.com/repos/goatslacker/alt/issues/49/events","html_url":"https://github.com/goatslacker/alt/issues/49","id":60228511,"number":49,"title":"Create a util for data fetching","user":{"login":"goatslacker","id":10632,"avatar_url":"https://avatars.githubusercontent.com/u/10632?v=3","gravatar_id":"","url":"https://api.github.com/users/goatslacker","html_url":"https://github.com/goatslacker","followers_url":"https://api.github.com/users/goatslacker/followers","following_url":"https://api.github.com/users/goatslacker/following{/other_user}","gists_url":"https://api.github.com/users/goatslacker/gists{/gist_id}","starred_url":"https://api.github.com/users/goatslacker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goatslacker/subscriptions","organizations_url":"https://api.github.com/users/goatslacker/orgs","repos_url":"https://api.github.com/users/goatslacker/repos","events_url":"https://api.github.com/users/goatslacker/events{/privacy}","received_events_url":"https://api.github.com/users/goatslacker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/goatslacker/alt/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/goatslacker/alt/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/goatslacker/alt/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-07T22:47:42Z","updated_at":"2015-03-08T13:39:06Z","closed_at":null,"body":"This would settle the \"how to do async\" debate.\r\n\r\nI wouldn't want this in core but I'm sure some of core would have to change so this can be supported first-class.\r\n\r\nThis util can be flexible so async can exists in actions or in stores or it can have a strict opinion.\r\n\r\nPerhaps several interfaces can be included so this can all be hooked up easily with popular ~~cloud~~ butt based systems"},"comment":{"url":"https://api.github.com/repos/goatslacker/alt/issues/comments/77749339","html_url":"https://github.com/goatslacker/alt/issues/49#issuecomment-77749339","issue_url":"https://api.github.com/repos/goatslacker/alt/issues/49","id":77749339,"user":{"login":"creatorrr","id":931887,"avatar_url":"https://avatars.githubusercontent.com/u/931887?v=3","gravatar_id":"","url":"https://api.github.com/users/creatorrr","html_url":"https://github.com/creatorrr","followers_url":"https://api.github.com/users/creatorrr/followers","following_url":"https://api.github.com/users/creatorrr/following{/other_user}","gists_url":"https://api.github.com/users/creatorrr/gists{/gist_id}","starred_url":"https://api.github.com/users/creatorrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/creatorrr/subscriptions","organizations_url":"https://api.github.com/users/creatorrr/orgs","repos_url":"https://api.github.com/users/creatorrr/repos","events_url":"https://api.github.com/users/creatorrr/events{/privacy}","received_events_url":"https://api.github.com/users/creatorrr/received_events","type":"User","site_admin":false},"created_at":"2015-03-08T13:39:06Z","updated_at":"2015-03-08T13:39:06Z","body":"I am currently using backbone models with co to fetch and update data from a server, like so:\r\n\r\n```javascript\r\nclass SyncModel extends Backbone.Model {\r\n  url () {\r\n    return \"/data\";\r\n  }\r\n}\r\n\r\nclass TechnicalDataStore {\r\n  constructor () {\r\n    this.data = {};\r\n    this.sync = new SyncModel(this.data);\r\n  }\r\n\r\n  updateSync () {\r\n    this.sync.set(this.data);\r\n  }\r\n\r\n  saveData* () {\r\n    let\r\n      request = Promise.resolve(this.sync.save()),\r\n      data = yield request;\r\n    return data;\r\n  }\r\n\r\n  onSubmit () {\r\n    co(this.saveData);\r\n  }\r\n}\r\n``` \r\n\r\nIf this looks like a good pattern, I could port it into a lightweight `alt` addon."}}