Skip to content

@opencraft/providence


Interface: ListModuleOptions\<T>

Defined in: lists/types/ListModuleOptions.ts:7

The construction parameters for lists dictate the behavior around handling its Singles and the network requests used to manage them.

Type Parameters

T

T

Properties

currentPage?

optional currentPage?: number

Defined in: lists/types/ListModuleOptions.ts:25

The current page of the request. This is always 1 in cases where the list endpoint isn't paginated.

Note that this value is fed to a transformation function and may change the value of params when set.

TODO: Implement and document the transformation functionality.


endpoint?

optional endpoint?: string

Defined in: lists/types/ListModuleOptions.ts:30

The URL for the endpoint this list tracks. # by default, which will make sure all the singles use # as well. See the Single module documentation for more details.


grow?

optional grow?: boolean

Defined in: lists/types/ListModuleOptions.ts:17

Whether the list should be an 'infinite scrolling' list where the more the user scrolls the more items are added, rather than replacing the entire page with a new page.


keyProp?

optional keyProp?: keyof T

Defined in: lists/types/ListModuleOptions.ts:53

The unique identifier key prop on the singles pulled from this endpoint. This will depend on your API but most of the time it will be 'id', which is the default value.


pageSize?

optional pageSize?: number

Defined in: lists/types/ListModuleOptions.ts:38

The page size to request from the server. The default for this is in the global settings.

Note that this value is fed to a transformation function and may change the value of params when set.

TODO: Implement and document the transformation functionality.


paginated?

optional paginated?: boolean

Defined in: lists/types/ListModuleOptions.ts:60

Whether or not this endpoint is paginated. Defaults to true. Paginated endpoints are put through transformation functions to handle the pagination.

TODO: Implement and document the transformation functionality.


params?

optional params?: QueryParams | null

Defined in: lists/types/ListModuleOptions.ts:62

The query string parameters used when performing network operations on the endpoint. *


persistent?

optional persistent?: boolean

Defined in: lists/types/ListModuleOptions.ts:48

If set to True, the registry will not remove this module even if all listening components are removed.


reverse?

optional reverse?: boolean

Defined in: lists/types/ListModuleOptions.ts:44

Flag that indicates if the contents of the list should be considered in inverted order. This is most useful when dealing with an endpoint that provides 'most recent' value as the last item. Most commonly used with 'growth', it can be used for situations like 'loading more comment history' and scrolling up to see the result.