Foxstore
  • Introduction
  • Base concepts
  • Store
  • Event handlers
  • Using store
    • Store by event scheme
    • Store by decorators
  • API Reference
    • Store
    • Handlers
    • Store options
      • Logging options
      • Saver
      • Dispatcher Options
Powered by GitBook
On this page

Was this helpful?

  1. API Reference
  2. Store options

Saver

One of the most popular problem of state is saving it. On Frontend it is saving to any Storage or sending data to server. So I decided to offer you an API which allows to control saving of Store.

export interface SaverOptions<State extends Record<string, unknown>> {
    /**
     * Select one of the default or create your custom Saver
     */
    saver: {
        new (store: ProtoStore<State>): Saver<State>;
    };
    /**
     * Which keys of State would be saved
     */
    keysToSave?: (keyof State)[];
    /**
     * Changing which keys of the State would be a trigger of saving
     */
    keysBySave?: (keyof State)[];
    /**
     * Project: Saver for separate entity in State
     * Does not work yet!
     */
    saverByKey?: SaverByKey<State>;
}

By default there is available savers like LocalStorageSaver.

PreviousLogging optionsNextDispatcher Options

Last updated 3 years ago

Was this helpful?