{"id":20542197,"url":"https://github.com/weivea/senior-fetch","last_synced_at":"2025-08-17T20:11:09.215Z","repository":{"id":83302597,"uuid":"175412936","full_name":"weivea/senior-fetch","owner":"weivea","description":"支持timeout超时 和 手动取消 abort() 的 fetch 方法,","archived":false,"fork":false,"pushed_at":"2019-03-13T12:06:17.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T04:29:25.408Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weivea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-03-13T12:05:58.000Z","updated_at":"2019-03-13T12:06:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa1189dc-e1f7-4749-bc48-44f436562956","html_url":"https://github.com/weivea/senior-fetch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/weivea/senior-fetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weivea%2Fsenior-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weivea%2Fsenior-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weivea%2Fsenior-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weivea%2Fsenior-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weivea","download_url":"https://codeload.github.com/weivea/senior-fetch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weivea%2Fsenior-fetch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270899582,"owners_count":24664720,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-16T01:29:45.584Z","updated_at":"2025-08-17T20:11:09.194Z","avatar_url":"https://github.com/weivea.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# senior-fetch\n\n支持timeout超时 和  手动取消 abort() 的 fetch 方法, \n\nps：只兼容原生支持 fetch 和 Promise的浏览器\n\n## 安装\n\n```\nnpm install senior-fetch\n```\n\n## 使用\n\n```javascript\nimport SeniorFrtch from 'senior-fetch';\n\n/*  ... */\nnew SeniorFrtch(input, init).fetch().then((resqonse) =\u003e {\n\n}).catch((error) =\u003e {\n\n});\n\n```\n配置与原生fetch一致，请参考: https://developer.mozilla.org/zh-CN/docs/Web/API/WindowOrWorkerGlobalScope/fetch\n\n\n### 设置timeout\n\n```javascript\nnew SeniorFrtch(url, {\n  timeout: 5000,\n  method: \"GET\"\n}).fetch().then((resqonse) =\u003e {\n\n}).catch((error) =\u003e {\n\n});\n// 超时会catch住 timeout 的error\n```\n\n### 手动取消 abort()\n\n```javascript\nconst fetchVM = new SeniorFrtch(url, {\n  timeout: 5000,\n  method: \"GET\"\n})\nfetchVM.fetch().then((resqonse) =\u003e {\n\n}).catch((error) =\u003e {\n\n});\n\n// 手动取消\nfetchVM.abort();\n\n// 取消会catch住 abort 的error\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweivea%2Fsenior-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweivea%2Fsenior-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweivea%2Fsenior-fetch/lists"}