Socket
Book a DemoInstallSign in
Socket

ngrx-sync-local-storage

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngrx-sync-local-storage

Extensions sync state to local storage

latest
npmnpm
Version
11.2.16
Version published
Maintainers
1
Created
Source

ngrx-sync-local-storage

Extensions sync state to local storage

Compatibility

ngrx-sync-local-storageAngular
12.x.x12.x.x
11.x.x11.x.x

Get started

1. Update AppComponent

import {NgrxSyncLocalStorageService} from "ngrx-sync-local-storage";
@Component()
export class AppComponent implements OnInit {

  constructor(
    private readonly renderer: Renderer2,
    private readonly store: Store<State>,
    private sync: NgrxSyncLocalStorageService
  ) {
  }

  ngOnInit() {
    this.sync.listenStorage(this.renderer, this.store);
  }

}

2. update AppModule


import {NgrxSyncLocalStorageModule} from "ngrx-sync-local-storage";

@NgModule({
 
  imports: [
   
    NgrxSyncLocalStorageModule
  ],
 
})
export class AppModule {
}

3. Update meta reducer


import {localStorageSyncReducer} from 'ngrx-sync-local-storage';

export function addLocalStorageSyncReducer(reducer: ActionReducer<any>): ActionReducer<any> {
  return localStorageSyncReducer(reducer, ['todos']);
}

export const metaReducers: MetaReducer<AppState>[] = [addLocalStorageSyncReducer]



FAQs

Package last updated on 03 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts