Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I think everyone had to write logic for limiting calls to effects or events. For example, limiting the number of repeated requests (take) or displaying some kind of warning if the user abuses a button or other interactive element (skip).
They are based on abstract and repeating elements that can be put into separate operators - skip & take.
These operators were inspired by their rxjs analogs:
skip - https://rxjs.dev/api/index/function/skip;
take - https://rxjs.dev/api/index/function/take.
I know the effector API tries to be minimalistic. I agree with this. But I don't consider these particular operators redundant.
If you think otherwise, you can safely close this PR by writing feedback.
In case of positive feedback, I am ready to complete the entire checklist for adding new operators and follow your comments in order to bring these operators to release.
Checklist for a new method
src
directory inparam-case
src/method-name/index.ts
in ESModules export incamelCase
named exportsrc/method-name/method-name.test.ts
src/method-name/method-name.fork.test.ts
test-typings/method-name.ts
// @ts-expect-error
to mark expected type errorimport { expectType } from 'tsd'
to check expected return typesrc/method-name/readme.md
Patronum/MethodName
Motivation
,Formulae
,Arguments
andReturn
sections for each overloadExample
section for each overloadsrc/method-name/readme.md
title
. Make sure it uses camelCase syntax just like the method itselfslug
. Use param-case to write it. In most cases it will be just liketitle
desription
with one short sentence describing what method useful forgroup
. To categorize method on/operators
page. Full list of available groups, you can see in documentation/src/content/config.ts