{"action":"created","issue":{"url":"https://api.github.com/repos/cargomedia/CM/issues/1755","labels_url":"https://api.github.com/repos/cargomedia/CM/issues/1755/labels{/name}","comments_url":"https://api.github.com/repos/cargomedia/CM/issues/1755/comments","events_url":"https://api.github.com/repos/cargomedia/CM/issues/1755/events","html_url":"https://github.com/cargomedia/CM/issues/1755","id":71926367,"number":1755,"title":"Ajax/Promise \"throttler\" to avoid multiple requests","user":{"login":"njam","id":360800,"avatar_url":"https://avatars.githubusercontent.com/u/360800?v=3","gravatar_id":"","url":"https://api.github.com/users/njam","html_url":"https://github.com/njam","followers_url":"https://api.github.com/users/njam/followers","following_url":"https://api.github.com/users/njam/following{/other_user}","gists_url":"https://api.github.com/users/njam/gists{/gist_id}","starred_url":"https://api.github.com/users/njam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njam/subscriptions","organizations_url":"https://api.github.com/users/njam/orgs","repos_url":"https://api.github.com/users/njam/repos","events_url":"https://api.github.com/users/njam/events{/privacy}","received_events_url":"https://api.github.com/users/njam/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cargomedia/CM/labels/focus4","name":"focus4","color":"fad8c7"},{"url":"https://api.github.com/repos/cargomedia/CM/labels/ready","name":"ready","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"vogdb","id":372386,"avatar_url":"https://avatars.githubusercontent.com/u/372386?v=3","gravatar_id":"","url":"https://api.github.com/users/vogdb","html_url":"https://github.com/vogdb","followers_url":"https://api.github.com/users/vogdb/followers","following_url":"https://api.github.com/users/vogdb/following{/other_user}","gists_url":"https://api.github.com/users/vogdb/gists{/gist_id}","starred_url":"https://api.github.com/users/vogdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vogdb/subscriptions","organizations_url":"https://api.github.com/users/vogdb/orgs","repos_url":"https://api.github.com/users/vogdb/repos","events_url":"https://api.github.com/users/vogdb/events{/privacy}","received_events_url":"https://api.github.com/users/vogdb/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2015-04-29T16:41:38Z","updated_at":"2015-06-19T12:20:29Z","closed_at":null,"body":"We often times want to avoid multiple concurrent ajax requests of the same time.\r\n\r\nUsually we do:\r\n```js\r\nvar requestList = {};\r\n\r\n/**\r\n * @returns Promise\r\n */\r\nfunction doSomething()  {\r\n if (requestList['something']) {\r\n  return requestList['something'];\r\n }\r\n return requestList['something'] = ajax();\r\n}\r\n```\r\n\r\nIt would be nice to wrap this into a small script, so we don't need to declare `requestList` every time, plus have a nicer interface. Preferably it would would work as kind of like a \"Promise throttling\":\r\n```js\r\n/**\r\n * @returns Promise\r\n */\r\nfunction doSomething() {\r\n return promiseThrottler('something', function() {\r\n  return ajax(); // returns Promise\r\n });\r\n}\r\n```\r\n\r\n@vogdb @tomaszdurka thoughts?\r\nRelated to https://github.com/cargomedia/CM/issues/1754"},"comment":{"url":"https://api.github.com/repos/cargomedia/CM/issues/comments/113497667","html_url":"https://github.com/cargomedia/CM/issues/1755#issuecomment-113497667","issue_url":"https://api.github.com/repos/cargomedia/CM/issues/1755","id":113497667,"user":{"login":"tomaszdurka","id":113303,"avatar_url":"https://avatars.githubusercontent.com/u/113303?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaszdurka","html_url":"https://github.com/tomaszdurka","followers_url":"https://api.github.com/users/tomaszdurka/followers","following_url":"https://api.github.com/users/tomaszdurka/following{/other_user}","gists_url":"https://api.github.com/users/tomaszdurka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaszdurka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaszdurka/subscriptions","organizations_url":"https://api.github.com/users/tomaszdurka/orgs","repos_url":"https://api.github.com/users/tomaszdurka/repos","events_url":"https://api.github.com/users/tomaszdurka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaszdurka/received_events","type":"User","site_admin":false},"created_at":"2015-06-19T12:20:29Z","updated_at":"2015-06-19T12:20:29Z","body":"It would be great to focus on this issue next @vogdb, wdyt?"}}