@gjsify/abort-controller 0.3.20 → 0.3.21
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.
- package/lib/esm/index.js +1 -1
- package/package.json +4 -4
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DOMException as e,Event as t,EventTarget as n}from"@gjsify/dom-events";const r=Symbol(`abort`),i=Symbol(`internal`);var a=class
|
|
1
|
+
import{DOMException as e,Event as t,EventTarget as n}from"@gjsify/dom-events";const r=Symbol(`abort`),i=Symbol(`internal`);var a=class AbortSignal extends n{#e=!1;reason=void 0;onabort=null;constructor(e){if(super(),e!==i)throw TypeError(`Illegal constructor.`)}get aborted(){if(!(this instanceof AbortSignal))throw TypeError(`'get aborted' called on an object that is not a valid instance of AbortSignal.`);return this.#e}get[Symbol.toStringTag](){return`AbortSignal`}throwIfAborted(){if(this.#e)throw this.reason}[r](n){if(this.#e)return;this.#e=!0,this.reason=n??new e(`The operation was aborted.`,`AbortError`);let r=new t(`abort`);typeof this.onabort==`function`&&this.onabort.call(this,r),this.dispatchEvent(r)}static abort(e){let t=new AbortSignal(i);return t[r](e),t}static timeout(t){let n=new AbortSignal(i);return setTimeout(()=>{n[r](new e(`The operation timed out.`,`TimeoutError`))},t),n}static any(e){let t=new AbortSignal(i);for(let n of e)if(n.aborted)return t[r](n.reason),t;let onAbort=()=>{if(!t.aborted){let n=e.find(e=>e.aborted);t[r](n?.reason)}};for(let t of e)t.addEventListener(`abort`,onAbort,{once:!0});return t}},o=class AbortController{signal;constructor(){this.signal=new a(i)}abort(e){if(!(this instanceof AbortController))throw TypeError(`'abort' called on an object that is not a valid instance of AbortController.`);this.signal[r](e)}},s={AbortController:o,AbortSignal:a};export{o as AbortController,a as AbortSignal,e as DOMException,s as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/abort-controller",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Web AbortController module for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"buffer"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@gjsify/cli": "^0.3.
|
|
44
|
-
"@gjsify/unit": "^0.3.
|
|
43
|
+
"@gjsify/cli": "^0.3.21",
|
|
44
|
+
"@gjsify/unit": "^0.3.21",
|
|
45
45
|
"@types/node": "^25.6.2",
|
|
46
46
|
"typescript": "^6.0.3"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@gjsify/dom-events": "^0.3.
|
|
49
|
+
"@gjsify/dom-events": "^0.3.21"
|
|
50
50
|
}
|
|
51
51
|
}
|