effector/patronum

Operator proposal: `idle`

igorkamyshev opened this issue · 1 comments

Some operations in our application have lower priority than others, I purpose to add an operator to postpone event propagation until browser is idle.

const $fitler = restore(fitlerChanged, null)

const $filteredItems = createStore([])

sample({
  clock: idle({ clock: filterChanged }),
  source: $items,
  fn: doSmth,
  target: $filteredItems
})

In this case, we can change $filter value immediate and respond to user input, but filtering of a large list will be delayed.

What about case when no clock is provided?
For example, plan event triggering until browser is idle.

const readyToCompute = idle();