yumauri / effector-storage

Module for Effector ☄️ to sync stores with `localStorage` (or `sessionStorage`)
MIT License
105 stars 3 forks source link

Add `clock` option #15

Closed yumauri closed 3 years ago

yumauri commented 3 years ago

To the form persist({ source, target }), something like:

persist({
  source: $store,
  clock: doPersist,
})

In order to be more "API-compliment" with effector

yumauri commented 3 years ago

Added to both forms in version 4.3.0. It is possible to debounce writes to the storage a bit more easily now:

import { debounce } from 'patronum/debounce'
import { persist } from 'effector-storage/local'

// ---8<---
persist({
  store: $store,
  clock: debounce({ source: $store, timeout: 100 }),
})