Conversation
| }); | ||
|
|
||
| return merge([ | ||
| calledAfterCondition, |
There was a problem hiding this comment.
if condition is already true then call event immediately
| return merge([ | ||
| calledAfterCondition, | ||
| combineEvents({ | ||
| events: [calledBeforeCondition, condition.updates.filter({ fn: Boolean })], |
There was a problem hiding this comment.
if condition is not true yet then defer event call until condition became true
| calledAfterCondition, | ||
| combineEvents({ | ||
| events: [calledBeforeCondition, condition.updates.filter({ fn: Boolean })], | ||
| reset: condition.updates.filter({ fn: (value) => !value }), |
There was a problem hiding this comment.
if condition became true and then false we should reset combine events since event call should be deferred until condition will be true again
| filter: not(condition), | ||
| }); | ||
|
|
||
| return merge([ |
There was a problem hiding this comment.
there could be 4 cases:
- Event called, condition is true --> call event
- Event called, condition is false --> wait until condition will be true and call event
- Condition became true, event is not called yet --> wait until event is called
- Condition became false, event is not called yet --> reset the state and wait both for event and condition to become true
IMPORTANT: if clock will be called more than 1 time only the last event will be deferred and called. Other events will be ignored
|
My suggestion is to write test(s) P.S. yes I know that defer is a common practice but still applicable example will be very much appreciated |
|
Added default pull request template to help making new operator |
Description
#329
(Why we should add this method?)
Checklist for a new method
srcdirectory inparam-casesrc/method-name/index.tsin ESModules export incamelCasenamed exportsrc/method-name/method-name.test.tssrc/method-name/method-name.fork.test.tstest-typings/method-name.ts// @ts-expect-errorto mark expected type errorimport { expectType } from 'tsd'to check expected return typesrc/method-name/readme.mdPatronum/MethodNameMotivation,Formulae,ArgumentsandReturnsections for each overloadExamplesection for each overloadsrc/method-name/readme.mdtitle. Make sure it uses camelCase syntax just like the method itselfslug. Use param-case to write it. In most cases it will be just liketitledesriptionwith one short sentence describing what method useful forgroup. To categorize method on/operatorspage. Full list of available groups, you can see in documentation/src/content/config.ts