@fatcherjs/middleware-aborter 1.4.1 → 1.6.1
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/dist/aborter.min.js +1 -1
- package/package.json +3 -3
package/dist/aborter.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){typeof exports=="object"&&typeof module
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.FatcherMiddlewareAborter={}))})(this,function(t){"use strict";const e={};function p(o={}){const{timeout:u=0,onAbort:s=null,concurrency:_,groupBy:c}=o;let l=u;return(isNaN(u)||~~u<0)&&(console.warn("[fatcher-middleware-aborter] Timeout is not a valid number."),l=0),{name:"fatcher-middleware-aborter",async use(i,v){var d,f,b;const m=new AbortController,{abort:y,signal:a}=m,w=v({signal:a}),r=(d=c==null?void 0:c(i))!=null?d:`${i.url}_${i.method}_${new URLSearchParams(i.params).toString()}`;((f=e[r])==null?void 0:f.length)&&_&&e[r].forEach(n=>{n.abort("concurrency")}),(b=e[r])!=null||(e[r]=[]);const h=n=>{y.call(m),s==null||s(n)};return e[r].push({abort:h,timer:l?setTimeout(()=>h("timeout"),l):null,signal:a}),a.addEventListener("abort",()=>{e[r]=e[r].filter(n=>n.signal===a?(n.timer&&clearTimeout(n.timer),!1):!0),e[r].length||delete e[r]}),w}}}function g(o){return o instanceof DOMException&&o.name==="AbortError"}t.aborter=p,t.isAbortError=g,Object.defineProperty(t,"__esModule",{value:!0})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fatcherjs/middleware-aborter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"main": "dist/aborter.js",
|
|
5
5
|
"module": "dist/aborter.esm.js",
|
|
6
6
|
"browser": "dist/aborter.min.js",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git+https://github.com/fatcherjs/fatcher.git"
|
|
16
16
|
},
|
|
17
|
-
"
|
|
18
|
-
"fatcher": "^1.
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"fatcher": "^1.6.1"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"dev": "rimraf dist && rollup -c rollup.config.ts -w",
|