Skip to main content

LensStudio:AssetLibrary.Pagination

Class

Configuration for the page to be accessed in a "LensStudio:AssetLibrary".AssetFilter.

Index

Properties

Methods

Example

// Pagination controls page offset and limit for asset library queries.
// Use the static singleBatch() factory -- the constructor is protected.
const { Pagination, AssetFilter } = await import('LensStudio:AssetLibrary');

// Create a pagination for the first 20 results
const page = Pagination.singleBatch(0, 20);
console.log('Offset:', page.offset); // 0
console.log('Limit:', page.limit); // 20

// Attach pagination to an AssetFilter
const filter = new AssetFilter();
filter.pagination = page;
filter.searchText = 'sunglasses';
console.log('Filter configured with pagination and search text');

// Fetch the next page
const nextPage = Pagination.singleBatch(20, 20);
filter.pagination = nextPage;
console.log('Advanced to offset:', nextPage.offset);

Properties

limit

readonly limit: number

Maximum number of items to return in a single page.


offset

readonly offset: number

Starting index for the current page of results.

Methods

singleBatch()

static singleBatch(offset, limit): Pagination

Creates a Pagination instance with the given offset and limit for a single batch request.

Parameters

ParameterType
offsetnumber
limitnumber

Returns

Pagination