reflex icon indicating copy to clipboard operation
reflex copied to clipboard

More Reflex.Time and related functions

Open lspitzner opened this issue 7 years ago • 2 comments

See https://gist.github.com/lspitzner/18e679006765b308e9dbc41b06e86bbb

  • gateGather: an accumulating gate
  • maskCalmE: behaves like throttle, but not controlled by time, but by input dynamic
  • conditionalBuffer: a buffer that can conditionally retain one input event value
  • fanBy: (eventsWhenFalse, eventWhenTrue) = fanBy pred inputE
  • fanOn: (eventsWhenFalse, eventWhenTrue) = fanOn boolBeh inputE
  • triggerDelay: behaves like delay, but not controlled by time, but my a second input event
  • executeAsync1Calm: perform an event asynchronously, but do not run more than one at a time
  • executeAsync1CalmWith: with custom forker function
  • gateThrottle: like throttle but without any accumulation. better for debouncing bursts.

All names open for discussion.

Only gateThrottle actually uses time, so I doubt that Reflex.Time is the right module, but not sure where else these would belong.

lspitzner avatar Apr 07 '18 14:04 lspitzner

I have added conditionalBuffer because it was necessary to fix the semantics of executeAsync1Calm(With). Preventing logic loops when inputs get connected to outputs is tricky.. hope things are fixed now.

lspitzner avatar Apr 09 '18 17:04 lspitzner

To be clear, I am ready to turn this into a PR, presuming that there is interest in having these included and that we decide on which module to put these in.

lspitzner avatar Apr 09 '18 17:04 lspitzner