Introduction
Last updated
Was this helpful?
Last updated
Was this helpful?
NGXS Persistence API (@anglar-ru/ngxs) 🚀 See it in action on Stackblitz
NGXS Persistence API is an extension based the Repository Design Pattern that offers a gentle introduction to NGXS by simplifying management of entities or plain data while reducing the amount of explicitness.
The main purpose of this extension is to provide the necessary layer of abstraction for states. Automates the creation of actions, dispatchers, and selectors for each entity type.
Benefits:
Angular-way (State as a Service
)
Snapshot's from state out-of-the-box (@Computed()
)
Support debounce for throttling dispatch (@Debounce()
)
Simple manipulation with data from states (NgxsDataRepository<T>
)
Automatic type inference from selection data stream (myState.state$
)
Immutable state context out-of-the-box (NgxsImmutableDataRepository<T>
)
Entity adapter out-of-the-box (NgxsDataEntityCollectionsRepository<V, K>
)
Simple API for testing states (ngxsTestingPlatform([A], (store: Store, a: A) => {...})
)
Persistence state out-of-the-box in sessionStorage, localStorage, custom (@Persistence()
)
Automatic action naming by service methods for improved debugging (@DataAction(), @Payload(), @Named()
)
Minimal peer dependencies:
Require minimal @ngxs/store v3.6.2
Require minimal TypeScript v3.7.2
Before
counter.state.ts
app.component.ts
After
counter.state.ts
app.component.ts