{"issue":{"title":"Provide \"magic\" resolution of promises in components","user":{"login":"rmurphey","id":58987,"url":"https://api.github.com/users/rmurphey","avatar_url":"https://secure.gravatar.com/avatar/0177cdce6af15e10db15b6bf5dc4e0b0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"0177cdce6af15e10db15b6bf5dc4e0b0"},"created_at":"2011-12-15T22:08:25Z","milestone":null,"state":"open","updated_at":"2011-12-28T20:10:23Z","labels":[],"id":2573268,"closed_at":null,"html_url":"https://github.com/Toura/mulberry/issues/211","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"It's very common for a component to need to update itself once some async operation concludes. To deal with this now, we end up writing code like:\r\n\r\n```\r\nthis.node.somePromise.then(dojo.hitch(this, '_dealWithIt'));\r\n```\r\n\r\nWe should add a property to components that would handle this automatically:\r\n\r\n```\r\nwhen : {\r\n  'somePromise' : '_dealWithIt'\r\n}\r\n```\r\n\r\nTo do this, we'd add something like the following to `postCreate`:\r\n\r\n```\r\ndojo.forIn(this.when, function(promise, resolver) {\r\n  promise.then(dojo.hitch(this, resolver));\r\n}, this);\r\n```","number":211,"url":"https://api.github.com/repos/Toura/mulberry/issues/211","comments":2,"assignee":null},"comment":{"user":{"login":"mrdanimal","id":130146,"url":"https://api.github.com/users/mrdanimal","avatar_url":"https://secure.gravatar.com/avatar/8b16854d26d415073fe930587911c2f4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"8b16854d26d415073fe930587911c2f4"},"created_at":"2011-12-28T20:10:23Z","updated_at":"2011-12-28T20:10:23Z","id":3294597,"body":"I like it. I vote for the 'when' syntax. It's shorter, and matches dojo convention, so it's clearer that you're dealing with a promise.","url":"https://api.github.com/repos/Toura/mulberry/issues/comments/3294597"},"action":"created"}