Skip to content

Commit

Permalink
chore(release): 1.5.0
Browse files Browse the repository at this point in the history
# [1.5.0](v1.4.1...v1.5.0) (2022-04-28)

### Features

* add retryWithBackoff utility ([#22](#22)) ([82c596a](82c596a))
  • Loading branch information
semantic-release-bot committed Apr 28, 2022
1 parent 82c596a commit 6500997
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [1.5.0](https://github.com/jaredLunde/exploration/compare/v1.4.1...v1.5.0) (2022-04-28)


### Features

* add retryWithBackoff utility ([#22](https://github.com/jaredLunde/exploration/issues/22)) ([82c596a](https://github.com/jaredLunde/exploration/commit/82c596a83678f708bdab86b89dff2ab84194661c))

## [1.4.1](https://github.com/jaredLunde/exploration/compare/v1.4.0...v1.4.1) (2022-04-26)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "exploration",
"version": "1.4.1",
"version": "1.5.0",
"description": "",
"license": "MIT",
"author": "Jared Lunde <jared.lunde@gmail.com> (https://jaredlunde.com/)",
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ export type { SelectionsProps, UseSelectionsPlugin } from "./use-selections";
export { useVirtualize } from "./use-virtualize";
export type { UseVirtualizeConfig, UseVirtualizeResult, } from "./use-virtualize";
export { useVisibleNodes } from "./use-visible-nodes";
export { mergeProps } from "./utils";
export { mergeProps, retryWithBackoff } from "./utils";
2 changes: 1 addition & 1 deletion types/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions types/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,43 @@ export declare function mergeProps<T extends Props[]>(args: T): UnionToIntersect
export declare function chain<Args extends any[]>(...callbacks: Args): (...args: Args) => void;
export declare function throttle<CallbackArguments extends any[]>(callback: (...args: CallbackArguments) => void, fps?: number, leading?: boolean): (...args: CallbackArguments) => void;
export declare function shallowEqual<A extends Record<string | number | symbol, unknown> | null, B extends Record<string | number | symbol, unknown> | null>(objA: A, objB: B | A): boolean;
/**
* Retry a promise until it resolves or the max number of retries is reached.
*
* @param promiseFn - A function that returns a promise to retry
* @param config - Options
* @param config.maxRetries - Max number of retries
* @param config.initialDelay - Initial delay before first retry
* @param config.delayMultiple - Multiplier for each subsequent retry
* @param config.shouldRetry - A function that should return `false` to stop retrying
*/
export declare function retryWithBackoff<T>(promiseFn: () => Promise<T>, config?: RetryWithBackoffConfig): Promise<T>;
export interface RetryWithBackoffConfig {
/**
* Max number of retries
*
* @default 4
*/
maxRetries?: number;
/**
* Initial delay before first retry
*
* @default 100
*/
initialDelay?: number;
/**
* Multiplier for each subsequent retry
*
* @default 2
*/
delayMultiple?: number;
/**
* A function that should return `false` to stop retrying
*
* @param error - The error that caused the retry
*/
shouldRetry?: (error: unknown) => boolean;
}
interface Props {
[key: string]: any;
}
Expand Down

0 comments on commit 6500997

Please sign in to comment.