1.1.3 • Published 10 months ago

idbpaging v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

 

About

Pagination based on the indexeddb module idbx.

Technologies

The following tools were used in this project:

  • idbx - an indexedDB wrapper

Getting started

Deno:

import {IDBPaging} from "https://deno.land/x/idbpaging/mod.ts";

NodeJS/Deno (same thing):

import {IDBPaging} from "npm:idbpaging";

Browser:

import {IDBPaging} from "https://esm.sh/idbpaging";

Usage

Pages start by 1.

const pageSize = 10;
const paging = new IDBPaging(db, storeName, pageSize);

// get first page
var list = await paging.first();

// get last page
var list = await paging.last();

// get next page
var list = await paging.next();

// get previous page
var list = await paging.prev();

// get page by index
var list = await paging.go(1);

// count pages
var totalPages = await paging.count();

// list of items for the current page
var list = await paging.list;

// current page number
var pageNumber = await paging.pageNumber;

// items per page
var pageSize = await paging.pageSize;

// total number of pages
var totalPages = await paging.totalPages;

You can enable circular paging on-the-fly:

await paging.first();
// go to the last page by circular paging
await paging.prev(1, true);

await paging.first();
// you can even go further back or forth by circular paging
// If you have 10 pages, this will go to page 7
await paging.prev(3, true);

await paging.last();
// go to the first page by circular paging
await paging.next(1, true);

await paging.last();
// you can even go further back or forth by circular paging
// If you have 10 pages, this will go to page 3
await paging.next(3, true);

ToDo

  • Proper documentation

License

This project is under license from MIT. For more details, see the LICENSE file.

Made by Mario Stöcklein

 

Back to top

1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago