Skip to content

Commit b54b2b0

Browse files
authored
[add] Progress Observable object for fetch() requests (#11)
1 parent 39d4277 commit b54b2b0

13 files changed

+1281
-1059
lines changed

.github/pr-badge.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- icon: visualstudio
2+
label: 'GitHub.dev'
3+
message: 'PR-$prNumber'
4+
color: 'blue'
5+
url: 'https://github.dev/$owner/$repo/pull/$prNumber'
6+
7+
- icon: github
8+
label: 'GitHub codespaces'
9+
message: 'PR-$prNumber'
10+
color: 'black'
11+
url: 'https://codespaces.new/$owner/$repo/pull/$prNumber'
12+
13+
- icon: git
14+
label: 'GitPod.io'
15+
message: 'PR-$prNumber'
16+
color: 'orange'
17+
url: 'https://gitpod.io/?autostart=true#https://github.com/$owner/$repo/pull/$prNumber'

.github/settings.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
2+
3+
repository:
4+
allow_merge_commit: false
5+
6+
delete_branch_on_merge: true
7+
8+
enable_vulnerability_alerts: true
9+
10+
labels:
11+
- name: bug
12+
color: '#d73a4a'
13+
description: Something isn't working
14+
15+
- name: documentation
16+
color: '#0075ca'
17+
description: Improvements or additions to documentation
18+
19+
- name: duplicate
20+
color: '#cfd3d7'
21+
description: This issue or pull request already exists
22+
23+
- name: enhancement
24+
color: '#a2eeef'
25+
description: Some improvements
26+
27+
- name: feature
28+
color: '#16b33f'
29+
description: New feature or request
30+
31+
- name: good first issue
32+
color: '#7057ff'
33+
description: Good for newcomers
34+
35+
- name: help wanted
36+
color: '#008672'
37+
description: Extra attention is needed
38+
39+
- name: invalid
40+
color: '#e4e669'
41+
description: This doesn't seem right
42+
43+
- name: question
44+
color: '#d876e3'
45+
description: Further information is requested
46+
47+
- name: wontfix
48+
color: '#ffffff'
49+
description: This will not be worked on
50+
51+
branches:
52+
- name: master
53+
# https://docs.github.com/en/rest/reference/repos#update-branch-protection
54+
protection:
55+
# Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
56+
required_pull_request_reviews:
57+
# The number of approvals required. (1-6)
58+
required_approving_review_count: 1
59+
# Dismiss approved reviews automatically when a new commit is pushed.
60+
dismiss_stale_reviews: true
61+
# Blocks merge until code owners have reviewed.
62+
require_code_owner_reviews: true
63+
# Specify which users and teams can dismiss pull request reviews.
64+
# Pass an empty dismissal_restrictions object to disable.
65+
# User and team dismissal_restrictions are only available for organization-owned repositories.
66+
# Omit this parameter for personal repositories.
67+
dismissal_restrictions:
68+
# users: []
69+
# teams: []
70+
# Required. Require status checks to pass before merging. Set to null to disable
71+
required_status_checks:
72+
# Required. Require branches to be up to date before merging.
73+
strict: true
74+
# Required. The list of status checks to require in order to merge into this branch
75+
contexts: []
76+
# Required. Enforce all configured restrictions for administrators.
77+
# Set to true to enforce required status checks for repository administrators.
78+
# Set to null to disable.
79+
enforce_admins: true
80+
# Prevent merge commits from being pushed to matching branches
81+
required_linear_history: true
82+
# Required. Restrict who can push to this branch.
83+
# Team and user restrictions are only available for organization-owned repositories.
84+
# Set to null to disable.
85+
restrictions: null

ReadMe.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,12 @@ import { HTTPError } from 'koajax';
171171

172172
auto();
173173

174-
self.addEventListener('unhandledrejection', event => {
175-
if (!(event.reason instanceof URIError)) return;
174+
window.addEventListener('unhandledrejection', ({ reason }) => {
175+
if (!(reason instanceof HTTPError)) return;
176176

177-
const { message } = (event.reason as HTTPError).body;
177+
const { message } = reason.response.body;
178178

179-
if (!message) return;
180-
181-
event.preventDefault();
182-
183-
self.alert(message);
179+
if (message) window.alert(message);
184180
});
185181
```
186182

package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "koajax",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"license": "LGPL-3.0",
55
"author": "[email protected]",
66
"description": "HTTP Client based on Koa-like middlewares",
@@ -25,9 +25,10 @@
2525
"main": "dist/index.js",
2626
"module": "dist/index.esm.js",
2727
"dependencies": {
28-
"@swc/helpers": "^0.5.11",
29-
"iterable-observer": "^1.0.1",
28+
"@swc/helpers": "^0.5.12",
29+
"iterable-observer": "^1.1.0",
3030
"regenerator-runtime": "^0.14.1",
31+
"web-streams-polyfill": "^4.0.0",
3132
"web-utility": "^4.4.0"
3233
},
3334
"peerDependencies": {
@@ -38,22 +39,22 @@
3839
"@parcel/transformer-typescript-types": "~2.12.0",
3940
"@types/core-js": "^2.5.8",
4041
"@types/jest": "^29.5.12",
41-
"@types/jsdom": "^21.1.6",
42-
"@types/node": "^18.19.33",
43-
"core-js": "^3.37.1",
42+
"@types/jsdom": "^21.1.7",
43+
"@types/node": "^18.19.44",
44+
"core-js": "^3.38.0",
4445
"cross-env": "^7.0.3",
45-
"husky": "^9.0.11",
46+
"husky": "^9.1.4",
4647
"jest": "^29.7.0",
4748
"jest-environment-jsdom": "^29.7.0",
48-
"jsdom": "^24.0.0",
49-
"lint-staged": "^15.2.2",
49+
"jsdom": "^24.1.1",
50+
"lint-staged": "^15.2.9",
5051
"open-cli": "^8.0.0",
5152
"parcel": "~2.12.0",
52-
"prettier": "^3.2.5",
53-
"ts-jest": "^29.1.2",
54-
"typedoc": "^0.25.13",
55-
"typedoc-plugin-mdn-links": "^3.1.25",
56-
"typescript": "~5.5.0-beta"
53+
"prettier": "^3.3.3",
54+
"ts-jest": "^29.2.4",
55+
"typedoc": "^0.26.5",
56+
"typedoc-plugin-mdn-links": "^3.2.8",
57+
"typescript": "~5.5.4"
5758
},
5859
"prettier": {
5960
"singleQuote": true,

0 commit comments

Comments
 (0)