1.1.2 ā€¢ Published 2 months ago

zustand-debounce v1.1.2

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

Zustand Debounce

zustand-debounce is a library that extends the capabilities of Zustand to provide a JSON state storage system with delayed (debounced) writing to storage. With this tool, you can reduce the number of write operations to storage by delaying and grouping them.

āœ… šŸ™ Lightweight!! 367 B gzipped.

āœ… šŸš€ Easy integration into your projects.

āœ… šŸ•’ Customize the debounce time according to your needs.

āœ… šŸ”„ Avoid frequent writes to storage.

āœ… Full TypeScript support.

Installation

pnpm add zustand-debounce
# o
npm install zustand-debounce
# o
yarn add zustand-debounce

Usage

import { createDebouncedJSONStorage } from "zustand-debounce"

// Replace createJSONStorage with createDebouncedJSONStorage
// Experience the enchantment of delayed writes āœØ
export const usePersonStore = create<PersonState & Actions>()(
  persist(storeApi, {
    name: "person-storage",
    storage: createDebouncedJSONStorage(firebaseStorage, {
      debounceTime: 2000, // Debounce time in milliseconds ā³
    }),
  }),
)

Contributions

Contributions are welcome. If you find an issue or have an idea to improve zustand-debounce, feel free to open an issue or submit a pull request.

License šŸ“œ

Licensed as MIT open source.

1.1.1

2 months ago

1.1.0

2 months ago

1.1.2

2 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago