{"action":"created","issue":{"url":"https://api.github.com/repos/iTowns/itowns2/issues/95","repository_url":"https://api.github.com/repos/iTowns/itowns2","labels_url":"https://api.github.com/repos/iTowns/itowns2/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/iTowns/itowns2/issues/95/comments","events_url":"https://api.github.com/repos/iTowns/itowns2/issues/95/events","html_url":"https://github.com/iTowns/itowns2/pull/95","id":163204071,"number":95,"title":"Use Promise for Commands","user":{"login":"peppsac","id":2198295,"avatar_url":"https://avatars.githubusercontent.com/u/2198295?v=3","gravatar_id":"","url":"https://api.github.com/users/peppsac","html_url":"https://github.com/peppsac","followers_url":"https://api.github.com/users/peppsac/followers","following_url":"https://api.github.com/users/peppsac/following{/other_user}","gists_url":"https://api.github.com/users/peppsac/gists{/gist_id}","starred_url":"https://api.github.com/users/peppsac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peppsac/subscriptions","organizations_url":"https://api.github.com/users/peppsac/orgs","repos_url":"https://api.github.com/users/peppsac/repos","events_url":"https://api.github.com/users/peppsac/events{/privacy}","received_events_url":"https://api.github.com/users/peppsac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-30T16:08:27Z","updated_at":"2016-07-01T09:30:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/iTowns/itowns2/pulls/95","html_url":"https://github.com/iTowns/itowns2/pull/95","diff_url":"https://github.com/iTowns/itowns2/pull/95.diff","patch_url":"https://github.com/iTowns/itowns2/pull/95.patch"},"body":"Commands are async, so Promise are a good fit for this usage.\r\n\r\nIt will ease the transition to remove logic code from Providers.\r\nSimplified example:\r\n```js\r\n    // calling site\r\n    interCommand.request(args, node);\r\n\r\n    // provider\r\n    Provider.prototype.executeCommand = function(command){\r\n        return this.getColorTextures(tile, services).then(function(result)\r\n        {\r\n            this.setTexturesLayer(result, destination);\r\n        }.bind(tile));\r\n```\r\n\r\nWould become:\r\n\r\n```js\r\n    // calling site\r\n    interCommand.request(args, node).then(function(textures) {\r\n          node.setTexturesLayer(result,destination);\r\n    });\r\n\r\n    // provider\r\n    Provider.prototype.executeCommand = function(command){\r\n        return this.getColorTextures(tile, services).then(function(result)\r\n        {\r\n            command.resolve(result);\r\n        };\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/iTowns/itowns2/issues/comments/229901995","html_url":"https://github.com/iTowns/itowns2/pull/95#issuecomment-229901995","issue_url":"https://api.github.com/repos/iTowns/itowns2/issues/95","id":229901995,"user":{"login":"qdnguyen","id":3224540,"avatar_url":"https://avatars.githubusercontent.com/u/3224540?v=3","gravatar_id":"","url":"https://api.github.com/users/qdnguyen","html_url":"https://github.com/qdnguyen","followers_url":"https://api.github.com/users/qdnguyen/followers","following_url":"https://api.github.com/users/qdnguyen/following{/other_user}","gists_url":"https://api.github.com/users/qdnguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/qdnguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qdnguyen/subscriptions","organizations_url":"https://api.github.com/users/qdnguyen/orgs","repos_url":"https://api.github.com/users/qdnguyen/repos","events_url":"https://api.github.com/users/qdnguyen/events{/privacy}","received_events_url":"https://api.github.com/users/qdnguyen/received_events","type":"User","site_admin":false},"created_at":"2016-07-01T09:30:40Z","updated_at":"2016-07-01T09:30:40Z","body":"Cool but if you can add web workers in this module to parallelize tasks, it is even better!"}}
{"actor":{"display_login":"qdnguyen"}}