mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-07 14:46:41 +00:00
chore(pockethost): rename TryCatchConfig
This commit is contained in:
parent
b55b3651da
commit
d34a2f62b5
@ -3,7 +3,7 @@ import { LoggerService } from '../common'
|
|||||||
|
|
||||||
export const TRYFETCH_RETRY_MS = 50
|
export const TRYFETCH_RETRY_MS = 50
|
||||||
|
|
||||||
export type Config = {
|
export type TryFetchConfig = {
|
||||||
preflight: () => Promise<boolean>
|
preflight: () => Promise<boolean>
|
||||||
retryMs: number
|
retryMs: number
|
||||||
}
|
}
|
||||||
@ -21,8 +21,11 @@ export type Config = {
|
|||||||
*
|
*
|
||||||
* Note: tryFetch exits ONLY on success or a rejected preflight.
|
* Note: tryFetch exits ONLY on success or a rejected preflight.
|
||||||
*/
|
*/
|
||||||
export const tryFetch = async (url: string, config?: Partial<Config>) => {
|
export const tryFetch = async (
|
||||||
const { preflight, retryMs }: Config = {
|
url: string,
|
||||||
|
config?: Partial<TryFetchConfig>,
|
||||||
|
) => {
|
||||||
|
const { preflight, retryMs }: TryFetchConfig = {
|
||||||
preflight: async () => true,
|
preflight: async () => true,
|
||||||
retryMs: TRYFETCH_RETRY_MS,
|
retryMs: TRYFETCH_RETRY_MS,
|
||||||
...config,
|
...config,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user