Comparing version 1.15.0 to 1.15.1
@@ -1,2 +0,2 @@ | ||
/*! idmp v1.15.0 | (c) github/haozi | MIT */ | ||
/*! idmp v1.15.1 | (c) github/haozi | MIT */ | ||
const p = () => { | ||
@@ -3,0 +3,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/*! idmp v1.15.0 | (c) github/haozi | MIT */ | ||
/*! idmp v1.15.1 | (c) github/haozi | MIT */ | ||
(function(n,i){typeof exports=="object"&&typeof module!="undefined"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(n=typeof globalThis!="undefined"?globalThis:n||self,i(n.idmp={}))})(this,function(n){"use strict";const g=()=>{},l=t=>t<0?0:t>6048e5?6048e5:t;n.g={};const a=t=>{const{maxRetry:f=30,maxAge:u=3e3,onBeforeRetry:c=g}=t||{},m=l(u);return{maxRetry:f,maxAge:m,onBeforeRetry:c,f:u===1/0}},r=t=>{t&&delete n.g[t]},_=()=>{n.g={}},h=(t,f,u)=>{if(!t)return f();const{maxRetry:c,maxAge:m,onBeforeRetry:p,f:R}=a(u);n.g[t]=n.g[t]||{0:0,1:0,4:[]};const e=n.g[t],T=()=>{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]=[],R||setTimeout(()=>{r(t)},m)},y=()=>{const o=e[4].length-c;for(let s=0;s<o;++s)e[4][s][1](e[3]);r(t)},A=()=>new Promise((o,s)=>{if(!e[5]&&(e[5]=f),e[2]){o(e[2]);return}e[1]===0?(e[1]=1,e[4].push([o,s]),e[5]().then(d=>{e[2]=d,M(),e[1]=4}).catch(d=>{e[1]=3,e[3]=d,++e[0],e[0]>c?y():(p(d,{globalKey:t,retryCount:e[0]}),T(),setTimeout(A,(e[0]-1)*50))})):e[1]===1&&e[4].push([o,s])});return A()};h.flush=r,h.flushAll=_,n.default=h,n.getOptions=a,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@@ -1,2 +0,2 @@ | ||
/*! idmp v1.15.0 | (c) github/haozi | MIT */ | ||
/*! idmp v1.15.1 | (c) github/haozi | MIT */ | ||
const DEFAULT_MAX_AGE = 3e3; | ||
@@ -3,0 +3,0 @@ const _7days = 6048e5; |
@@ -1,2 +0,2 @@ | ||
/*! idmp v1.15.0 | (c) github/haozi | MIT */ | ||
/*! idmp v1.15.1 | (c) github/haozi | MIT */ | ||
const DEFAULT_MAX_AGE = 3e3; | ||
@@ -3,0 +3,0 @@ const _7days = 6048e5; |
{ | ||
"name": "idmp", | ||
"version": "1.15.0", | ||
"version": "1.15.1", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "deduplicate network requests", |
@@ -68,3 +68,3 @@ /*! idmp v1.0.0 | (c) github/haozi | MIT */ | ||
const localData = storage.get(globalKey); | ||
if (localData) { | ||
if (localData !== udf) { | ||
if (process.env.NODE_ENV !== "production") { | ||
@@ -78,3 +78,3 @@ console.log( | ||
const memoryData = await promiseFunc(); | ||
if (memoryData) { | ||
if (memoryData !== udf) { | ||
storage.set(globalKey, memoryData, finalOptions.maxAge); | ||
@@ -81,0 +81,0 @@ } |
@@ -34,2 +34,3 @@ # idmp/browser-storage | ||
Data persistence only supports string type `globalKey` and data structures that can be serialized by `JSON.stringify` | ||
- Data persistence only supports string type `globalKey` and data structures that can be serialized by `JSON.stringify` | ||
- If return value is `undefined` it will not be cached, you must return `null` |
@@ -51,7 +51,7 @@ /*! idmp v1.0.0 | (c) github/haozi | MIT */ | ||
const localData = await getData(globalKey); | ||
if (localData) { | ||
if (localData !== udf) { | ||
return localData; | ||
} | ||
const memoryData = await promiseFunc(); | ||
if (memoryData) { | ||
if (memoryData !== udf) { | ||
setData(globalKey, memoryData, finalOptions.maxAge); | ||
@@ -58,0 +58,0 @@ } |
@@ -25,2 +25,3 @@ # idmp/node-fs | ||
Data persistence only supports string type `globalKey` and data structures that can be serialized by [serialize-javascript](https://www.npmjs.com/package/serialize-javascript) | ||
- Data persistence only supports string type `globalKey` and data structures that can be serialized by [serialize-javascript](https://www.npmjs.com/package/serialize-javascript) | ||
- If return value is `undefined` it will not be cached, you must return `null` |
Sorry, the diff of this file is not supported yet
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
89724