{"id":15657566,"url":"https://github.com/kitsonk/xhr","last_synced_at":"2025-04-15T11:29:03.020Z","repository":{"id":39650201,"uuid":"382222824","full_name":"kitsonk/xhr","owner":"kitsonk","description":"An XMLHttpRequest polyfill for Deno CLI and Deploy 🦕","archived":false,"fork":false,"pushed_at":"2024-10-07T09:52:07.000Z","size":79,"stargazers_count":24,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T19:21:34.282Z","etag":null,"topics":["deno","polyfill","xhr"],"latest_commit_sha":null,"homepage":"https://jsr.io/@kitsonk/xhr","language":"TypeScript","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/kitsonk.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":"2021-07-02T03:46:31.000Z","updated_at":"2024-12-31T14:38:40.000Z","dependencies_parsed_at":"2024-01-17T04:14:25.628Z","dependency_job_id":"a23a9b14-2cd9-4494-96ed-3dc0a641b209","html_url":"https://github.com/kitsonk/xhr","commit_stats":{"total_commits":11,"total_committers":4,"mean_commits":2.75,"dds":0.2727272727272727,"last_synced_commit":"855cdc2ed46b8f406e8a3b144133c821a443fccf"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitsonk%2Fxhr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitsonk%2Fxhr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitsonk%2Fxhr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitsonk%2Fxhr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitsonk","download_url":"https://codeload.github.com/kitsonk/xhr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249060632,"owners_count":21206362,"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":["deno","polyfill","xhr"],"created_at":"2024-10-03T13:08:13.602Z","updated_at":"2025-04-15T11:29:02.996Z","avatar_url":"https://github.com/kitsonk.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# xhr\n\n[![xhr ci](https://github.com/kitsonk/xhr/workflows/ci/badge.svg)](https://github.com/kitsonk/xhr)\n\nA `XMLHttpRequest` polyfill for [Deno CLI](https://deno.land/) and\n[Deno Deploy](https://deno.com/deploy/). The main intent is to make code written\nfor a browser that uses `XMLHttpRequest` to fetch JSON, bytes, or text\nasynchronously work with Deno.\n\n\u003e ![WARNING]\n\u003e At this stage, this polyfill is very experimental and is not well tested. USE\n\u003e AT YOUR OWN RISK. Bug reports are welcome.\n\nThis polyfill has several known/intentional limitations from a browser standard\n`XMLHttpRequest`:\n\n- It does not handle XML, though the name implies it, nor does it handle HTML\n  being treated as a response type `\"document\"`. This uses the browser's built\n  in parser to parse the XML and HTML into a DOM object.\n- Sync is not supported (passing `false` to the `async` argument). Most browsers\n  have deprecated it in the main thread. Since this polyfill works by calling\n  Deno's `fetch()` it is nearly impossible to generate a sync version, plus it\n  is a really bad idea to block a thread while waiting for a server response.\n  **Don't do it, don't use software that requires it.**\n\n## Usage\n\nImport the module. The module will analyze the global scope, and if\n`XMLHttpRequest` and its associated APIs are not defined, it will add them:\n\n```ts\nimport \"jsr:/@kitsonk/xhr\";\n```\n\nNow, `XMLHttpRequest` should be available in the global scope.\n\n## Types\n\nThe built in types for Deno do not include the `XMLHttpRequest` and associated\ntypes, so if you are type checking your code and get errors about them not being\ndefined, there are a couple of solutions. If your code is generally written for\nthe browser, you might want to consider\n[Targeting Deno and the Browser](https://docs.deno.com/runtime/manual/advanced/typescript/configuration#targeting-deno-and-the-browser)\nsection of the Deno Manual.\n\nIf all you want to do is \"polyfill\" the types, they are available here under\n`./globals.d.ts`. You can either import them like:\n\n```ts\nimport type {} from \"jsr:/@kitsonk/xhr/globals\";\n```\n\nOr using the triple slash reference like:\n\n```ts\n/// \u003creference types=\"jsr:/@kitsonk/xhr/globals\" /\u003e\n```\n\n---\n\nCopyright 2021-2024 Kitson P. Kelly. All rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitsonk%2Fxhr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitsonk%2Fxhr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitsonk%2Fxhr/lists"}