{"library":"patronum","title":"Patronum: Effector Operators and Utilities","description":"Patronum is a comprehensive utility library designed to extend the core capabilities of the Effector state management framework, providing a rich collection of operators and methods for common reactive programming patterns. It helps Effector developers implement functionality like debouncing, throttling, delays, status tracking for effects, event combination, and store value manipulation with significantly less boilerplate. The current stable version is 2.3.0, and the project exhibits an active development and release cadence, frequently adding new operators and improving existing ones, often with multiple minor and patch releases within a few months. Its key differentiator lies in its deep integration and specialization for the Effector ecosystem, offering purpose-built, type-safe solutions that seamlessly work with Effector's primitive units like Stores, Events, and Effects, fostering modularity and maintainability in complex applications. While it simplifies many common tasks, users must pay attention to its `effector` peer dependency version for compatibility.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install patronum"],"cli":null},"imports":["import { status } from 'patronum';","import { debounce } from 'patronum';","import { combineEvents } from 'patronum';","import { spread } from 'patronum';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { createEvent, createEffect, createStore } from 'effector';\nimport { status, debounce, pending, spread } from 'patronum';\n\n// Example 1: Track effect status\nconst userLoadFx = createEffect<string, { name: string }, Error>();\nconst $userLoadStatus = status({ effect: userLoadFx });\n\nuserLoadFx.use(async (userId) => {\n  console.log(`Loading user ${userId}...`);\n  await new Promise(resolve => setTimeout(resolve, 500));\n  return { name: `User ${userId}` };\n});\n\n$userLoadStatus.watch(s => console.log('User load status:', s));\nuserLoadFx('1'); // Initiates user loading\n\n// Example 2: Debounce an event for search input\nconst searchInputChanged = createEvent<string>();\nconst $searchTerm = createStore('');\n\n// Debounce the search input event by 300ms\nconst debouncedSearch = debounce({\n  source: searchInputChanged,\n  timeout: 300\n});\n\ndebouncedSearch.watch(term => console.log('Debounced search term:', term));\n\nsearchInputChanged('a');\nsetTimeout(() => searchInputChanged('ab'), 100);\nsetTimeout(() => searchInputChanged('abc'), 200); // Only 'abc' will be logged after 300ms from its last call\n","lang":"typescript","description":"This example demonstrates how to use `status` to track the state of an Effector effect and `debounce` to rate-limit an Effector event for use cases like search inputs.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}