patronum icon indicating copy to clipboard operation
patronum copied to clipboard

Operator proposal: `idle`

Open igorkamyshev opened this issue 3 years ago • 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.

igorkamyshev avatar Aug 02 '22 05:08 igorkamyshev

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

const readyToCompute = idle();

sergeysova avatar Feb 15 '23 09:02 sergeysova