Socket
Socket
Sign inDemoInstall

idmp

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idmp - npm Package Compare versions

Comparing version 1.9.2 to 1.10.0

2

dist/index.browser.esm.js

@@ -1,2 +0,2 @@

/*! idmp v1.9.2 | (c) github/haozi | MIT */
/*! idmp v1.10.0 | (c) github/haozi | MIT */
const R = () => {

@@ -3,0 +3,0 @@ };

@@ -1,2 +0,2 @@

/*! idmp v1.9.2 | (c) github/haozi | MIT */
/*! idmp v1.10.0 | (c) github/haozi | MIT */
(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"}})});

@@ -7,3 +7,3 @@ /**

*/
export interface IdmpOptions {
interface IdmpOptions {
/**

@@ -27,3 +27,3 @@ * Maximum number of retry attempts.

* @param {Object} extra - Additional parameters.
* @param {GlobalKey} extra.globalKey - The global key.
* @param {IdmpGlobalKey} extra.globalKey - The global key.
* @param {number} extra.retryCount - The current retry count.

@@ -33,3 +33,3 @@ * @returns {void}

onBeforeRetry?: (err: any, extra: {
globalKey: GlobalKey;
globalKey: IdmpGlobalKey;
retryCount: number;

@@ -64,9 +64,10 @@ }) => void;

}>;
type GlobalKey = string | number | symbol | false | null | undefined;
type IdmpGlobalKey = string | number | symbol | false | null | undefined;
declare const idmp: {
<T>(globalKey: GlobalKey, promiseFunc: IdmpPromise<T>, options?: IdmpOptions): Promise<T>;
flush: (globalKey: GlobalKey) => void;
<T>(globalKey: IdmpGlobalKey, promiseFunc: IdmpPromise<T>, options?: IdmpOptions): Promise<T>;
flush: (globalKey: IdmpGlobalKey) => void;
flushAll: () => void;
};
type Idmp = typeof idmp;
export default idmp;
export { _globalStore as g };
export { _globalStore as g, type Idmp, type IdmpGlobalKey, type IdmpOptions, type IdmpPromise };

@@ -1,2 +0,2 @@

/*! idmp v1.9.2 | (c) github/haozi | MIT */
/*! idmp v1.10.0 | (c) github/haozi | MIT */
const DEFAULT_MAX_AGE = 3e3;

@@ -3,0 +3,0 @@ const _7days = 6048e5;

@@ -1,2 +0,2 @@

/*! idmp v1.9.2 | (c) github/haozi | MIT */
/*! idmp v1.10.0 | (c) github/haozi | MIT */
const DEFAULT_MAX_AGE = 3e3;

@@ -3,0 +3,0 @@ const _7days = 6048e5;

{
"name": "idmp",
"version": "1.9.2",
"version": "1.10.0",
"keywords": [

@@ -5,0 +5,0 @@ "cache response",

@@ -70,7 +70,7 @@ # idmp

<T>(
globalKey: GlobalKey,
globalKey: IdmpGlobalKey,
promiseFunc: IdmpPromise<T>,
options?: IdmpOptions,
): Promise<T>
flush: (globalKey: GlobalKey) => void
flush: (globalKey: IdmpGlobalKey) => void
flushAll: () => void

@@ -80,3 +80,3 @@ }

type IdmpPromise<T> = () => Promise<T>
type GlobalKey = string | number | symbol | false | null | undefined
type IdmpGlobalKey = string | number | symbol | false | null | undefined
```

@@ -90,3 +90,3 @@

| `maxAge` | `number` | `3000` | Maximum age in milliseconds. The maximum value is 604800000ms (7 days). |
| `onBeforeRetry` | `function` | - | Function to be executed before a retry attempt. Takes two parameters: `err` (any type) and `extra` (an object with properties `globalKey` of type `GlobalKey` and `retryCount` of type `number`). Returns `void`. |
| `onBeforeRetry` | `function` | - | Function to be executed before a retry attempt. Takes two parameters: `err` (any type) and `extra` (an object with properties `globalKey` of type `IdmpGlobalKey` and `retryCount` of type `number`). Returns `void`. |

@@ -93,0 +93,0 @@ ## flush

@@ -70,7 +70,7 @@ # idmp

<T>(
globalKey: GlobalKey,
globalKey: IdmpGlobalKey,
promiseFunc: IdmpPromise<T>,
options?: IdmpOptions,
): Promise<T>
flush: (globalKey: GlobalKey) => void
flush: (globalKey: IdmpGlobalKey) => void
flushAll: () => void

@@ -80,3 +80,3 @@ }

type IdmpPromise<T> = () => Promise<T>
type GlobalKey = string | number | symbol | false | null | undefined
type IdmpGlobalKey = string | number | symbol | false | null | undefined
```

@@ -90,3 +90,3 @@

| `maxAge` | `number` | `3000` | Maximum age in milliseconds. The maximum value is 604800000ms (7 days). |
| `onBeforeRetry` | `function` | - | Function to be executed before a retry attempt. Takes two parameters: `err` (any type) and `extra` (an object with properties `globalKey` of type `GlobalKey` and `retryCount` of type `number`). Returns `void`. |
| `onBeforeRetry` | `function` | - | Function to be executed before a retry attempt. Takes two parameters: `err` (any type) and `extra` (an object with properties `globalKey` of type `IdmpGlobalKey` and `retryCount` of type `number`). Returns `void`. |

@@ -93,0 +93,0 @@ ## flush

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc