npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-signal-paginator

v1.0.4

Published

NgxSignalPaginator is an Angular library that provides a signal-based store for handling pagination. It integrates seamlessly with `@ngrx/signals` and supports features such as lazy loading, caching, error handling, and retry mechanisms.

Downloads

14

Readme

NgxSignalPaginator

NgxSignalPaginator is an Angular library that provides a signal-based store for handling pagination. It integrates seamlessly with @ngrx/signals and supports features such as lazy loading, caching, error handling, and retry mechanisms.

For more information about the Signal Store, refer to the official NgRx Documentation.

Installation

To install the library, run the following command:

npm install ngx-signal-paginator

Usage

createPaginationSignalStore

Import

import { createPaginationSignalStore } from "ngx-signal-paginator";

Create the Pagination Store

Use the createPaginationSignalStore function to create a pagination store for your data:

store = inject(createPaginationSignalStore<YourDataType>(debounceMs, retryAttempts, retryDelayMs, initialState));
  • debounceMs - Configurable debounce time for API requests.
  • retryAttempts - Configurable number of retry attempts for failed API requests.
  • retryDelayMs - Configurable delay between retry attempts for failed API requests.
  • initialState - The initial state of the paginator signal store.

Pass fetchFn, page and pageSize to the fetchPage method

this.store.fetchPage({ fetchFn: this.fetchMethod.bind(this), page: PAGE_NUMBER, pageSize: PAGE_SIZE });

Fetch the next page

this.store.nextPage();

Fetch the previous page

this.store.previousPage();

Jump to a specific page

this.store.jumpToPage(PAGE_NUMBER);

Caching

Caches fetched pages to reduce API calls. You can also get cached data using:

this.store.cache()

Change page size

this.store.setPageSize(DIFFERENT_PAGE_SIZE);

Error handling

Graceful error handling and state updates. The last error is stored in the store. You can get the error using:

this.store.error();

Restore to initial state

this.store.restoreToInitialState();

Clear state

this.store.clear();

createPaginationFeature

You can also get the Signal Paginator Store as Custom Store Feature (created using the signalStoreFeature function. For more information: NgRx Documentation).

Import

import { createPaginationFeature } from 'ngx-signal-paginator';

Use the createPaginationFeature within your signal store

export const YourStore = signalStore(
  createPaginationFeature<YourDataType>(debounceMs, retryAttempts, retryDelayMs, initialState),
  // other Signal Store Features 
)

NgxSignalPaginator Playground App

Examples of using the NgxSignalPaginator can be found in the Playground App.

License

This project is licensed under the MIT License.