Skip to content

Commit 08e00dd

Browse files
committed
2 parents d8453c6 + be59d66 commit 08e00dd

File tree

8 files changed

+72
-14
lines changed

8 files changed

+72
-14
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [4.0.16](https://github.com/nativescript-community/https/compare/v4.0.15...v4.0.16) (2023-03-14)
7+
8+
9+
### Features
10+
11+
* `cancelAllRequests` ([3a014bc](https://github.com/nativescript-community/https/commit/3a014bc9fe797d9b1405b9ed75348fba776d6eb2))
12+
13+
14+
15+
16+
617
## [4.0.15](https://github.com/nativescript-community/https/compare/v4.0.14...v4.0.15) (2023-03-06)
718

819

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
]
1919
}
2020
},
21-
"version": "4.0.15"
21+
"version": "4.0.16"
2222
}

packages/https/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [4.0.16](https://github.com/nativescript-community/https/compare/v4.0.15...v4.0.16) (2023-03-14)
7+
8+
**Note:** Version bump only for package @nativescript-community/https
9+
10+
11+
12+
13+
614
## [4.0.15](https://github.com/nativescript-community/https/compare/v4.0.14...v4.0.15) (2023-03-06)
715

816

packages/https/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript-community/https",
3-
"version": "4.0.15",
3+
"version": "4.0.16",
44
"description": "Nativescript plugin for https requests",
55
"main": "index",
66
"sideEffects": false,

src/https/request.android.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,32 @@ export function cancelRequest(tag: string, client: okhttp3.OkHttpClient = runnin
405405
}
406406
}
407407

408+
export function cancelAllRequests() {
409+
Object.values(notClosedResponses).forEach((req) => req.cancel());
410+
411+
Object.values(runningClients).forEach((client) => {
412+
const dispatcher = client.dispatcher();
413+
//When you want to cancel:
414+
//A) go through the queued calls and cancel if the tag matches:
415+
if (dispatcher.queuedCallsCount() > 0) {
416+
const queuedCalls = dispatcher.queuedCalls();
417+
for (let index = 0; index < queuedCalls.size(); index++) {
418+
const call = queuedCalls.get(index);
419+
call.cancel();
420+
}
421+
}
422+
423+
//B) go through the running calls and cancel if the tag matches:
424+
if (dispatcher.runningCallsCount() > 0) {
425+
const runningCalls = dispatcher.runningCalls();
426+
for (let index = 0; index < runningCalls.size(); index++) {
427+
const call = runningCalls.get(index);
428+
call.cancel();
429+
}
430+
}
431+
});
432+
}
433+
408434
export function clearCookies() {
409435
if (cookieJar) {
410436
cookieJar = null;

src/https/request.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export function setCache(options?: CacheOptions);
112112
export function clearCache();
113113
export function createRequest(opts: HttpsRequestOptions): HttpsRequest;
114114
export function cancelRequest(tag: string);
115+
export function cancelAllRequests();
115116
export function clearCookies();
116117
export function addNetworkInterceptor(interceptor);
117118

src/https/request.ios.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ export function cancelRequest(tag: string) {
308308
runningRequests[tag].cancel();
309309
}
310310
}
311+
export function cancelAllRequests() {
312+
Object.values(runningRequests).forEach(request=>{
313+
request.cancel()
314+
})
315+
}
311316

312317
export function clearCookies() {
313318
const storage = NSHTTPCookieStorage.sharedHTTPCookieStorage;

yarn.lock

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,14 @@ __metadata:
21922192
languageName: node
21932193
linkType: hard
21942194

2195-
"@nativescript-community/[email protected], @nativescript-community/https@workspace:packages/https":
2195+
"@nativescript-community/https@npm:4.0.11":
2196+
version: 4.0.11
2197+
resolution: "@nativescript-community/https@npm:4.0.11"
2198+
checksum: 587715cb290fe14e615f67f36e4e8b990176176b66353eea9af2171e16f6822e87dd4645e0d9748aacee7b4564fb51231fa04b671ff1f798137524bb99cefe1a
2199+
languageName: node
2200+
linkType: hard
2201+
2202+
"@nativescript-community/https@workspace:packages/https":
21962203
version: 0.0.0-use.local
21972204
resolution: "@nativescript-community/https@workspace:packages/https"
21982205
languageName: unknown
@@ -2273,10 +2280,10 @@ __metadata:
22732280

22742281
"@nativescript-community/template-snippet@file:demo-snippets::locator=root-workspace-0b6124%40workspace%3A.":
22752282
version: 0.0.1
2276-
resolution: "@nativescript-community/template-snippet@file:demo-snippets#demo-snippets::hash=737e66&locator=root-workspace-0b6124%40workspace%3A."
2283+
resolution: "@nativescript-community/template-snippet@file:demo-snippets#demo-snippets::hash=c63ecc&locator=root-workspace-0b6124%40workspace%3A."
22772284
dependencies:
22782285
"@nativescript-community/https": 4.0.11
2279-
checksum: d1ba570c0fedbcb0514871e037d901afd6fd1ec74990204a4faa4af860f7eb59f1716cc9e178a804e4ed23ab475b771795772151a9ee1cfbe6abe032691cd6ec
2286+
checksum: d1cf63a6261cb4e69527dd6b596fd7e0db2e9cf14be9e511d2079230faf7c577da96d0350d3d05610f6c8fac45d2d851b316d5df84cf8d678134af971829fb8b
22802287
languageName: node
22812288
linkType: hard
22822289

@@ -7435,7 +7442,7 @@ __metadata:
74357442

74367443
"fsevents@patch:fsevents@^2.3.2#~builtin<compat/fsevents>, fsevents@patch:fsevents@~2.3.2#~builtin<compat/fsevents>":
74377444
version: 2.3.2
7438-
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1"
7445+
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7"
74397446
dependencies:
74407447
node-gyp: latest
74417448
conditions: os=darwin
@@ -13148,7 +13155,7 @@ __metadata:
1314813155

1314913156
"resolve@patch:resolve@^1.1.6#~builtin<compat/resolve>, resolve@patch:resolve@^1.1.7#~builtin<compat/resolve>, resolve@patch:resolve@^1.10.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.19.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.20.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.1#~builtin<compat/resolve>, resolve@patch:resolve@^1.9.0#~builtin<compat/resolve>":
1315013157
version: 1.22.1
13151-
resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin<compat/resolve>::version=1.22.1&hash=c3c19d"
13158+
resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin<compat/resolve>::version=1.22.1&hash=07638b"
1315213159
dependencies:
1315313160
is-core-module: ^2.9.0
1315413161
path-parse: ^1.0.7
@@ -13161,7 +13168,7 @@ __metadata:
1316113168

1316213169
"resolve@patch:resolve@^2.0.0-next.3#~builtin<compat/resolve>":
1316313170
version: 2.0.0-next.4
13164-
resolution: "resolve@patch:resolve@npm%3A2.0.0-next.4#~builtin<compat/resolve>::version=2.0.0-next.4&hash=c3c19d"
13171+
resolution: "resolve@patch:resolve@npm%3A2.0.0-next.4#~builtin<compat/resolve>::version=2.0.0-next.4&hash=07638b"
1316513172
dependencies:
1316613173
is-core-module: ^2.9.0
1316713174
path-parse: ^1.0.7
@@ -14867,17 +14874,17 @@ __metadata:
1486714874

1486814875
"typescript@patch:typescript@^3 || ^4#~builtin<compat/typescript>, typescript@patch:typescript@^4.6.4#~builtin<compat/typescript>":
1486914876
version: 4.9.4
14870-
resolution: "typescript@patch:typescript@npm%3A4.9.4#~builtin<compat/typescript>::version=4.9.4&hash=ad5954"
14877+
resolution: "typescript@patch:typescript@npm%3A4.9.4#~builtin<compat/typescript>::version=4.9.4&hash=a1c5e5"
1487114878
bin:
1487214879
tsc: bin/tsc
1487314880
tsserver: bin/tsserver
14874-
checksum: 1caaea6cb7f813e64345190fddc4e6c924d0b698ab81189b503763c4a18f7f5501c69362979d36e19c042d89d936443e768a78b0675690b35eb663d19e0eae71
14881+
checksum: 37f6e2c3c5e2aa5934b85b0fddbf32eeac8b1bacf3a5b51d01946936d03f5377fe86255d4e5a4ae628fd0cd553386355ad362c57f13b4635064400f3e8e05b9d
1487514882
languageName: node
1487614883
linkType: hard
1487714884

1487814885
"typescript@patch:typescript@^3.5.3#~builtin<compat/typescript>":
1487914886
version: 3.9.10
14880-
resolution: "typescript@patch:typescript@npm%3A3.9.10#~builtin<compat/typescript>::version=3.9.10&hash=3bd3d3"
14887+
resolution: "typescript@patch:typescript@npm%3A3.9.10#~builtin<compat/typescript>::version=3.9.10&hash=a1c5e5"
1488114888
bin:
1488214889
tsc: bin/tsc
1488314890
tsserver: bin/tsserver
@@ -14887,7 +14894,7 @@ __metadata:
1488714894

1488814895
"typescript@patch:typescript@~4.2.3#~builtin<compat/typescript>":
1488914896
version: 4.2.4
14890-
resolution: "typescript@patch:typescript@npm%3A4.2.4#~builtin<compat/typescript>::version=4.2.4&hash=334f98"
14897+
resolution: "typescript@patch:typescript@npm%3A4.2.4#~builtin<compat/typescript>::version=4.2.4&hash=a1c5e5"
1489114898
bin:
1489214899
tsc: bin/tsc
1489314900
tsserver: bin/tsserver
@@ -14897,11 +14904,11 @@ __metadata:
1489714904

1489814905
"typescript@patch:typescript@~4.8.4#~builtin<compat/typescript>":
1489914906
version: 4.8.4
14900-
resolution: "typescript@patch:typescript@npm%3A4.8.4#~builtin<compat/typescript>::version=4.8.4&hash=0102e9"
14907+
resolution: "typescript@patch:typescript@npm%3A4.8.4#~builtin<compat/typescript>::version=4.8.4&hash=a1c5e5"
1490114908
bin:
1490214909
tsc: bin/tsc
1490314910
tsserver: bin/tsserver
14904-
checksum: 301459fc3eb3b1a38fe91bf96d98eb55da88a9cb17b4ef80b4d105d620f4d547ba776cc27b44cc2ef58b66eda23fe0a74142feb5e79a6fb99f54fc018a696afa
14911+
checksum: 563a0ef47abae6df27a9a3ab38f75fc681f633ccf1a3502b1108e252e187787893de689220f4544aaf95a371a4eb3141e4a337deb9895de5ac3c1ca76430e5f0
1490514912
languageName: node
1490614913
linkType: hard
1490714914

0 commit comments

Comments
 (0)