Comparing version 1.0.1 to 1.0.2
@@ -1,12 +0,14 @@ | ||
const p = () => { | ||
const A = () => { | ||
}; | ||
const E = (s) => s < 0 ? 0 : s > 6048e5 ? 6048e5 : s, o = {}, T = (s, i, _) => { | ||
const _ = (t) => !t || typeof t != "object" ? t : (Object.keys(t).forEach((s) => { | ||
typeof t[s] == "object" && !Object.isFrozen(t[s]) && _(t[s]); | ||
}), Object.freeze(t)), l = (t) => t < 0 ? 0 : t > 6048e5 ? 6048e5 : t, o = {}, D = (t, s, m) => { | ||
const { | ||
maxRetry: A = 30, | ||
maxRetry: E = 30, | ||
maxAge: c, | ||
onBeforeretry: m = p | ||
} = _ || {}, h = E(c || 3e3); | ||
if (!s) | ||
return i(); | ||
o[s] = o[s] || { | ||
onBeforeretry: p = A | ||
} = m || {}, h = l(c || 3e3); | ||
if (!t) | ||
return s(); | ||
o[t] = o[t] || { | ||
0: 0, | ||
@@ -16,33 +18,38 @@ 1: 0, | ||
}; | ||
const t = o[s], u = () => new Promise((n, f) => { | ||
if (!t[ | ||
const e = o[t], u = () => new Promise((r, f) => { | ||
if (!e[ | ||
5 | ||
/* oneCallPromiseFunc */ | ||
] && (t[ | ||
] && (e[ | ||
5 | ||
/* oneCallPromiseFunc */ | ||
] = i), t[ | ||
] = s), process.env.NODE_ENV !== "production" && e[ | ||
5 | ||
/* oneCallPromiseFunc */ | ||
].toString() !== s.toString() && console.error( | ||
`warn: the same key \`${t.toString()}\` may be used multiple times in different functions.` | ||
), e[ | ||
2 | ||
/* resData */ | ||
]) | ||
return n(t[ | ||
return r(e[ | ||
2 | ||
/* resData */ | ||
]); | ||
if (t[ | ||
if (e[ | ||
3 | ||
/* resError */ | ||
]) | ||
return f(t[ | ||
return f(e[ | ||
3 | ||
/* resError */ | ||
]); | ||
const r = (e) => { | ||
e ? delete o[s] : (t[ | ||
const i = (n) => { | ||
n ? delete o[t] : (e[ | ||
1 | ||
/* status */ | ||
] = 0, t[ | ||
] = 0, e[ | ||
2 | ||
/* resData */ | ||
] = void 0, t[ | ||
] = void 0, e[ | ||
3 | ||
@@ -52,7 +59,7 @@ /* resError */ | ||
}, d = () => { | ||
for (let e of t[ | ||
for (let n of e[ | ||
4 | ||
/* pendingList */ | ||
]) | ||
e[0](t[ | ||
n[0](e[ | ||
2 | ||
@@ -62,64 +69,67 @@ /* resData */ | ||
setTimeout(() => { | ||
r(!0); | ||
i(!0); | ||
}, h); | ||
}, a = () => { | ||
for (let e of t[ | ||
for (let n of e[ | ||
4 | ||
/* pendingList */ | ||
]) | ||
e[1](t[ | ||
n[1](e[ | ||
3 | ||
/* resError */ | ||
]); | ||
r(!0); | ||
i(!0); | ||
}; | ||
t[ | ||
e[ | ||
1 | ||
/* status */ | ||
] === 0 ? (t[ | ||
] === 0 ? (e[ | ||
1 | ||
/* status */ | ||
] = 1, t[ | ||
] = 1, e[ | ||
4 | ||
/* pendingList */ | ||
].push([n, f]), t[ | ||
].push([r, f]), e[ | ||
5 | ||
/* oneCallPromiseFunc */ | ||
]().then((e) => { | ||
t[ | ||
]().then((n) => { | ||
e[ | ||
1 | ||
/* status */ | ||
] = 4, t[ | ||
] = 4, process.env.NODE_ENV !== "production" ? e[ | ||
2 | ||
/* resData */ | ||
] = e, d(); | ||
}).catch((e) => { | ||
t[ | ||
] = _(n) : e[ | ||
2 | ||
/* resData */ | ||
] = n, d(); | ||
}).catch((n) => { | ||
e[ | ||
1 | ||
/* status */ | ||
] = 3, t[ | ||
] = 3, e[ | ||
3 | ||
/* resError */ | ||
] = e, ++t[ | ||
] = n, ++e[ | ||
0 | ||
/* retryCont */ | ||
], t[ | ||
], e[ | ||
0 | ||
/* retryCont */ | ||
] > A ? a() : (m(e, t[ | ||
] > E ? a() : (p(n, e[ | ||
0 | ||
/* retryCont */ | ||
]), r(!1), setTimeout(() => { | ||
]), i(!1), setTimeout(() => { | ||
u(); | ||
}, 16)); | ||
})) : t[ | ||
})) : e[ | ||
1 | ||
/* status */ | ||
] === 1 ? t[ | ||
] === 1 ? e[ | ||
4 | ||
/* pendingList */ | ||
].push([n, f]) : t[ | ||
].push([r, f]) : e[ | ||
1 | ||
/* status */ | ||
] === 4 ? d() : t[ | ||
] === 4 ? d() : e[ | ||
1 | ||
@@ -132,4 +142,4 @@ /* status */ | ||
export { | ||
T as default, | ||
D as default, | ||
o as g | ||
}; |
{ | ||
"name": "idmp", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "cache response", |
16659
186