{"id":32226004,"url":"https://github.com/ankitsorathiya/iron-multiple-ajax-behavior","last_synced_at":"2026-02-22T06:32:46.732Z","repository":{"id":58222164,"uuid":"82437297","full_name":"ankitsorathiya/iron-multiple-ajax-behavior","owner":"ankitsorathiya","description":"It is useful to send multiple XHR requests asynchronously and have one final handler to be invoked after all the requests are executed","archived":false,"fork":false,"pushed_at":"2018-04-26T12:48:29.000Z","size":1489,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-23T02:37:45.374Z","etag":null,"topics":["iron-ajax","polymer","polymer-behavior","polymer-components"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ankitsorathiya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-19T05:25:16.000Z","updated_at":"2018-04-29T08:17:11.000Z","dependencies_parsed_at":"2022-08-31T02:00:55.696Z","dependency_job_id":null,"html_url":"https://github.com/ankitsorathiya/iron-multiple-ajax-behavior","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ankitsorathiya/iron-multiple-ajax-behavior","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsorathiya%2Firon-multiple-ajax-behavior","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsorathiya%2Firon-multiple-ajax-behavior/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsorathiya%2Firon-multiple-ajax-behavior/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsorathiya%2Firon-multiple-ajax-behavior/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankitsorathiya","download_url":"https://codeload.github.com/ankitsorathiya/iron-multiple-ajax-behavior/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsorathiya%2Firon-multiple-ajax-behavior/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29706562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T05:59:28.568Z","status":"ssl_error","status_checked_at":"2026-02-22T05:58:46.208Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iron-ajax","polymer","polymer-behavior","polymer-components"],"created_at":"2025-10-22T09:42:54.672Z","updated_at":"2026-02-22T06:32:46.714Z","avatar_url":"https://github.com/ankitsorathiya.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iron-multiple-ajax-behavior\r\nIt is useful to send multiple XHR requests asynchronously and have one final handler to be invoked after all the requests are executed.\r\nIt is a polymer behvaior and can be easily used with the api based applicaton.\r\n\r\n###### Installation\r\n```\r\nbower install iron-multiple-ajax-behavior\r\n```\r\n###### Usage\r\n\r\nLet's take a situation where user has to call multiple api call and when all the api calls are executed certain action should be taken.\r\nThis is where iron-multiple-ajax-behavior can be useful, I know promises can do the same thing but this is written as Polymer Library.\r\n\r\n#Example\r\nGetting data from multiple sources and when all of them are recieved it should show data has been loades successfully.\r\nplease refere https://github.com/ankitsorathiya/iron-multiple-ajax-behavior/blob/master/demo/index.html\r\n\r\n###### First import following behavior\r\n```html\r\n\u003clink rel=\"import\" href=\"iron-multiple-ajax-behavior.html\"\u003e\r\n```\r\n###### Inject polymer behaviour into your polymer element.\r\n\r\n```\r\nPolymer({\r\n    is: \"iron-multiple-ajax-demo\",\r\n    behaviors: [window.extendedIronMultipleAjaxBehavior],\r\n    properties: {\r\n        items: {\r\n            type: Array,\r\n            value: function() {\r\n                return [];\r\n            }\r\n        },\r\n        dataLoaded: {\r\n            type: Boolean,\r\n            value: false\r\n        }\r\n    },\r\n    ready: function() {\r\n        this.initializeData();\r\n    },\r\n    initializeData: function() {\r\n        this.dataLoaded = false;\r\n        //prepare all requests to be initiated\r\n        var requests = [];\r\n        for (var index = 1; index \u003c= 10; index++) {\r\n            requests.push(this.getRequestObject(index));\r\n        }\r\n        //once we have all requests, fire multiple requests\r\n        //the finalResponseHandler will be executed when all the requests are served.\r\n        this._sendMultipleRequests(requests, \"finalResponseHandler\");\r\n    },\r\n    getRequestObject: function(index) {\r\n        var url = 'https://jsonplaceholder.typicode.com/posts/' + index;\r\n        return this._getIronRequestObj(url, \"individualDataRetrival\");\r\n    },\r\n    individualDataRetrival: function(item) {\r\n        this.push(\"items\", item);\r\n    },\r\n    finalResponseHandler: function(responses) {\r\n\r\n        //this will be invoked when all the requests are served either with success or failure.\r\n        this.dataLoaded = true;\r\n    }\r\n});\r\n ```\r\n\u003e You are good to go now!\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitsorathiya%2Firon-multiple-ajax-behavior","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankitsorathiya%2Firon-multiple-ajax-behavior","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitsorathiya%2Firon-multiple-ajax-behavior/lists"}