@d1g1tal/transportr 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +0,0 @@
1
- /**
2
- * A controller object that allows you to abort one or more Transportr requests.
3
- *
4
- * @module {SignalController} signal-controller
5
- * @author D1g1talEntr0py <jason.dimeo@gmail.com>
6
- *
7
- */
8
- export default class SignalController {
9
- /** @type {AbortController} */
10
- #abortController;
11
-
12
- /**
13
- * @param {AbortSignal} [signal] The signal to be used to abort the request.
14
- */
15
- constructor(signal) {
16
- this.#abortController = new AbortController();
17
- signal?.addEventListener('abort', () => this.#abortController.abort());
18
- }
19
-
20
- /**
21
- * Returns the {@link AbortSignal} object associated with this object.
22
- *
23
- * @returns {AbortSignal} The {@link AbortSignal} object associated with this object.
24
- */
25
- get signal() {
26
- return this.#abortController.signal;
27
- }
28
-
29
- /**
30
- * Aborts a DOM request before it has completed.
31
- * This is able to abort fetch requests, data sent using the XMLHttpRequest API, and Web Sockets.
32
- *
33
- * @param {DOMException} [reason] The reason for aborting the request.
34
- * @returns {void}
35
- */
36
- abort(reason) {
37
- this.#abortController.abort(reason);
38
- }
39
-
40
- /**
41
- * A String value that is used in the creation of the default string
42
- * description of an object. Called by the built-in method {@link Object.prototype.toString}.
43
- *
44
- * @override
45
- * @returns {string} The default string description of this object.
46
- */
47
- get [Symbol.toStringTag]() {
48
- return 'SignalController';
49
- }
50
- }