{"id":17134755,"url":"https://github.com/kapouer/window-agent","last_synced_at":"2025-03-24T06:17:54.335Z","repository":{"id":66100695,"uuid":"61237447","full_name":"kapouer/window-agent","owner":"kapouer","description":"Yet another browser agent, supports callback or promise, and parameters replacement","archived":false,"fork":false,"pushed_at":"2017-05-16T10:27:36.000Z","size":7,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T11:51:50.534Z","etag":null,"topics":["promise","querystrings","xhr"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/kapouer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-15T20:06:54.000Z","updated_at":"2016-06-15T20:10:00.000Z","dependencies_parsed_at":"2023-09-18T07:15:13.044Z","dependency_job_id":null,"html_url":"https://github.com/kapouer/window-agent","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"00850be08abc17927b25d0aea209ce262e03e1cc"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapouer%2Fwindow-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapouer%2Fwindow-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapouer%2Fwindow-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapouer%2Fwindow-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kapouer","download_url":"https://codeload.github.com/kapouer/window-agent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245217946,"owners_count":20579300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["promise","querystrings","xhr"],"created_at":"2024-10-14T19:45:42.201Z","updated_at":"2025-03-24T06:17:54.302Z","avatar_url":"https://github.com/kapouer.png","language":"JavaScript","readme":"window-agent\n============\n\nWhy another xhr agent ?\n-----------------------\n\n* no deps, no module loading\n* callback or promise\n* parameters replacement in url\n* takes advantage of browsers ability to parse requested html as DOM document\n\n\nInstall\n-------\n\n```\nnpm install window-agent\ncd public;\nln -s ../node_modules/window-agent/agent.js\n```\n\nUsage\n-----\n\nwindow.METHOD where METHOD is HEAD, GET, COPY, PUT, PATCH, DELETE, POST.\n\n```\n// GET /api/mycollection/45?eager=true\u0026type=a\u0026type=b\nwindow.GET(\"/api/mycollection/:id\", {\n\tid: 45,\n\teager: true,\n\ttype: [\"a\", \"b\"]\n}).then(function(item) {\n\t// supports promise style\n});\n\nwindow.POST(\"/api/mycollection/:id\", {\n\tid: 45 // can replace variables in url\n}, { // body, can also be already json since vers 1.1\n\tsomekey: data\n}, function(err, result) {\n\t// supports callback style as well\n});\n\n// /templates/test.html?lang=fr\nwindow.GET({\n\turl: \"/templates/test.html\",\n\ttype: \"html\"\t// tells it to return the document, not the string\n}, {\n\tlang:\"fr\"\n}).then(function(doc) {\n\t// doc.documentElement\n});\n\n```\n\nLicense\n-------\n\nSee LICENSE file.\n\n\nFuture\n------\n\nWill probably wrap Fetch API at some point.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapouer%2Fwindow-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkapouer%2Fwindow-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapouer%2Fwindow-agent/lists"}