Comparing version 1.7.4 to 1.8.0
@@ -97,8 +97,8 @@ const R = () => { | ||
t[ | ||
2 | ||
/* resData */ | ||
] = r, m(), t[ | ||
1 | ||
/* status */ | ||
] = 4, t[ | ||
2 | ||
/* resData */ | ||
] = r, m(); | ||
] = 4; | ||
}).catch((r) => { | ||
@@ -105,0 +105,0 @@ t[ |
@@ -1,1 +0,1 @@ | ||
(function(n,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(n=typeof globalThis!="undefined"?globalThis:n||self,f(n.idmp={}))})(this,function(n){"use strict";const l=()=>{},m=t=>t<0?0:t>6048e5?6048e5:t;n.g={};const i=t=>{t&&delete n.g[t]},A=()=>{n.g={}},d=(t,c,_)=>{const{maxRetry:r=30,maxAge:T=3e3,onBeforeRetry:a=l}=_||{},g=m(T);if(!t)return c();n.g[t]=n.g[t]||{0:0,1:0,4:[]};const e=n.g[t],p=()=>{e[1]=0,e[2]=void 0,e[3]=void 0},M=()=>{const o=e[4].length;for(let s=0;s<o;++s)e[4][s][0](e[2]);e[4]=[],setTimeout(()=>{i(t)},g)},R=()=>{const o=e[4].length-r;for(let s=0;s<o;++s)e[4][s][1](e[3]);i(t)},h=()=>new Promise((o,s)=>{if(!e[5]&&(e[5]=c),e[2]){o(e[2]);return}e[1]===0?(e[1]=1,e[4].push([o,s]),e[5]().then(u=>{e[1]=4,e[2]=u,M()}).catch(u=>{e[1]=3,e[3]=u,++e[0],e[0]>r?R():(a(u,{globalKey:t,retryCount:e[0]}),p(),setTimeout(h,(e[0]-1)*50))})):e[1]===1&&e[4].push([o,s])});return h()};d.flush=i,d.flushAll=A,n.default=d,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(n,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(n=typeof globalThis!="undefined"?globalThis:n||self,f(n.idmp={}))})(this,function(n){"use strict";const l=()=>{},m=t=>t<0?0:t>6048e5?6048e5:t;n.g={};const i=t=>{t&&delete n.g[t]},A=()=>{n.g={}},d=(t,c,_)=>{const{maxRetry:r=30,maxAge:T=3e3,onBeforeRetry:a=l}=_||{},g=m(T);if(!t)return c();n.g[t]=n.g[t]||{0:0,1:0,4:[]};const e=n.g[t],p=()=>{e[1]=0,e[2]=void 0,e[3]=void 0},M=()=>{const o=e[4].length;for(let s=0;s<o;++s)e[4][s][0](e[2]);e[4]=[],setTimeout(()=>{i(t)},g)},R=()=>{const o=e[4].length-r;for(let s=0;s<o;++s)e[4][s][1](e[3]);i(t)},h=()=>new Promise((o,s)=>{if(!e[5]&&(e[5]=c),e[2]){o(e[2]);return}e[1]===0?(e[1]=1,e[4].push([o,s]),e[5]().then(u=>{e[2]=u,M(),e[1]=4}).catch(u=>{e[1]=3,e[3]=u,++e[0],e[0]>r?R():(a(u,{globalKey:t,retryCount:e[0]}),p(),setTimeout(h,(e[0]-1)*50))})):e[1]===1&&e[4].push([o,s])});return h()};d.flush=i,d.flushAll=A,n.default=d,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@@ -133,6 +133,2 @@ const DEFAULT_MAX_AGE = 3e3; | ||
]().then((data) => { | ||
cache[ | ||
1 | ||
/* status */ | ||
] = 4; | ||
{ | ||
@@ -145,2 +141,6 @@ cache[ | ||
doResolves(); | ||
cache[ | ||
1 | ||
/* status */ | ||
] = 4; | ||
}).catch((err) => { | ||
@@ -147,0 +147,0 @@ cache[ |
@@ -89,2 +89,12 @@ const DEFAULT_MAX_AGE = 3e3; | ||
]); | ||
if (process.env.NODE_ENV !== "production") { | ||
if (i === 0) { | ||
console.log(`[idmp info] ${globalKey == null ? void 0 : globalKey.toString()} from origin`); | ||
} else { | ||
console.log( | ||
`%c[idmp info] ${globalKey == null ? void 0 : globalKey.toString()} from cache`, | ||
"color: gray" | ||
); | ||
} | ||
} | ||
} | ||
@@ -190,2 +200,8 @@ cache[ | ||
]) { | ||
if (process.env.NODE_ENV !== "production") { | ||
console.log( | ||
`%c[idmp info] \`${globalKey == null ? void 0 : globalKey.toString()}\` from cache`, | ||
"color: gray" | ||
); | ||
} | ||
resolve(cache[ | ||
@@ -213,6 +229,2 @@ 2 | ||
]().then((data) => { | ||
cache[ | ||
1 | ||
/* status */ | ||
] = 4; | ||
if (process.env.NODE_ENV !== "production") { | ||
@@ -230,2 +242,6 @@ cache[ | ||
doResolves(); | ||
cache[ | ||
1 | ||
/* status */ | ||
] = 4; | ||
}).catch((err) => { | ||
@@ -232,0 +248,0 @@ cache[ |
{ | ||
"name": "idmp", | ||
"version": "1.7.4", | ||
"version": "1.8.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "cache response", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63941
997