Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/six-houses-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scaleway/use-dataloader": patch
---

export a datalifetime object
22 changes: 22 additions & 0 deletions packages/use-dataloader/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const SECOND = 1000
const MINUTE = 60 * SECOND
const HOUR = 60 * MINUTE

export enum StatusEnum {
ERROR = 'error',
IDLE = 'idle',
Expand All @@ -7,3 +11,21 @@ export enum StatusEnum {

export const KEY_IS_NOT_STRING_ERROR = 'Key should be a string'
export const DEFAULT_MAX_CONCURRENT_REQUESTS = 20

export const POLLING_INTERVAL = {
'10S': 10 * SECOND,
'5S': 5 * SECOND,
'3S': 3 * SECOND,
} as const

export const DATALIFE_TIME = {
'2h': 2 * HOUR,
'1h': 1 * HOUR,
'5m': 5 * MINUTE,
'3m': 3 * MINUTE,
'1m': 1 * MINUTE,
'30S': 30 * SECOND,
'10S': 10 * SECOND,
'5S': 5 * SECOND,
NONE: 0,
} as const
1 change: 1 addition & 0 deletions packages/use-dataloader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export {
} from './DataLoaderProvider'
export { useDataLoader } from './useDataLoader'
export type { UseDataLoaderConfig } from './types'
export { DATALIFE_TIME, POLLING_INTERVAL } from './constants'
Loading