LimitOffsetPaginator

Source
import { LimitOffsetPaginator } from "@prestojs/util";
Hierarchy
  • Paginator<,>
  • LimitOffsetPaginator

Examples

Paginate manually

Use with usePaginator & paginationMiddleware

Store pagination state in the URL.

API

Constructor

new LimitOffsetPaginator(?currentStatePair,?internalStatePair)
Source

Arguments:

ArgumentTypeDescription
currentStatePairnull|[State, ]
internalStatePairnull|[State, ]

Methods

first()
Source
Returns:void
firstState()
Source
Returns:
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
getRequestInit(props)
Source

Arguments:

ArgumentTypeDescription
*propsObject
Returns:
An object with these properties:
PropertyTypeDescription
bodynull|BodyInit
cacheRequestCache
credentialsRequestCredentials
headersHeadersInit|Record
integritystring
keepaliveboolean
methodstring
modeRequestMode
queryRecord
redirectRequestRedirect
referrerstring
referrerPolicyReferrerPolicy
signalnull|AbortSignal
urlArgsRecord
windownull
hasNextPage()
Source
Returns:boolean
hasPreviousPage()
Source
Returns:boolean
last()
Source
Returns:void
lastState()
Source
Returns:null|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
limitState(limit)
Source

Arguments:

ArgumentTypeDescription
*limitnull|number
Returns:
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
next()
Source
Returns:void
nextState()
Source
Returns:null|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
offsetState(offset)
Source

Arguments:

ArgumentTypeDescription
*offsetnull|number
Returns:
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
previous()
Source
Returns:void
previousState()
Source
Returns:null|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
replaceStateControllers(currentStatePair,internalStatePair)
Source

Arguments:

ArgumentTypeDescription
*currentStatePair[State, ]
*internalStatePair[State, ]
Returns:void
setCurrentState(set)
Source

Arguments:

ArgumentTypeDescription
*set
Returns:void
setInternalState(set)
Source

Arguments:

ArgumentTypeDescription
*set
Returns:void
setLimit(limit)
Source

Arguments:

ArgumentTypeDescription
*limitnull|number
Returns:void
setOffset(offset)
Source

Arguments:

ArgumentTypeDescription
*offsetnull|number
Returns:void
setResponse(props)
Source

Arguments:

ArgumentTypeDescription
*props
Returns:void

Properties

currentState

Source
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string

internalState

Source
An object with these properties:
PropertyTypeDescription
responseIsSetboolean
totalnumber|null

limit

Source
null|number

offset

Source
number

responseIsSet

Source
boolean

total

Source
null|number

Static Methods

getPaginationState(requestDetails)
Source

Arguments:

ArgumentTypeDescription
*
requestDetails
An object with the properties below
requestDetails.decodedBodyany
requestDetails.queryRecord
requestDetails.responseResponse
*requestDetails.urlstring
requestDetails.urlArgsRecord
Returns:false|Record