@o3r/store-sync
TypeScript icon, indicating that this package has built-in type declarations

10.3.8 • Public • Published

Otter Store Sync

Super cute Otter!

This package is an Otter Framework Module.

Description

Stable Version Bundle Size

This module is exposing an NgRx store synchronization solution (synchronous and asynchronous) via the class StorageSync.

To facilitate the synchronization, the StorageSync class is based on a fork of ngrx-store-localstorage that is also exposed and includes the following changes on top of the original version:

  • Export properly the dateReviver function
  • Add missing comments
  • Explicit dependency to @ngrx/store for the action names
  • Change interface names to prefix with "sync"
  • Add logger support
  • Fix lint according to ESLint rules
  • Split code in several files
  • Migrate tests to Jest
  • Removal of deprecated deepmerge dependency.
  • Support of a smartSync setup to improve performances

Configuration

Smart sync

The original ngrx-store-localstorage synchronize all of your states everytime a state is updated which can lead to a lot of accesses to the local and session storage and cause performance issue.

To avoid this pitfall, by default the @o3r/store-sync only synchronizes a state if its value changed and no longer matches the storage. This behaviour can be disabled as follows:

const storage = new StorageSync({keys: [...myStorekeys]}, {disableSmartSync: true});

/@o3r/store-sync/

    Package Sidebar

    Install

    npm i @o3r/store-sync

    Weekly Downloads

    6,444

    Version

    10.3.8

    License

    BSD-3-Clause

    Unpacked Size

    155 kB

    Total Files

    45

    Last publish

    Collaborators

    • mrednic-1a
    • nicohoffmann
    • jbourgeois-1a
    • vscaiceanu-1a
    • kpanot