README
@fireflysemantics/slice
Lightweight Javascript Reactive State Management for Web Applications.
If you like the @fireflysemantics/slice API please star our Github Repository.
Install
Install Slice with peer dependencies:
npm i @fireflysemantics/slice tslib rxjs nanoid
Firefly Semantics Slice Development Center Documentation
Guides
- An Introduction to the Firefly Semantics Slice Reactive Object Store
- Introduction to the Firefly Semantics Slice Reactive Entity Store
- Recreating the Ngrx Demo with Slice
Tasks
- Changing the Firefly Semantics Slice EStore Default Configuration
- Observing the Currently Active Entities with Slice
- Derived Reactive Observable State with Slice
- Reactive Event Driven Actions with Firefly Semantics Slice
- Unsubscribing From Firefly Semantics Slice Object Store Observables in Angular
- Creating Proxies to Slice Object Store Observables
- Getting a Snapshot of a Slice Object Store Value
- Accessing Slice Object Store Observables In Angular Templates
Examples
API Documentation
The documentation for the API includes simple examples of how to apply the API to a use case.
Overview
Lightweight Reactive Server, Mobile, and Web Application State Management Built with RxJS
and Typescript
.
The API is designed to be as minimal as possible and should deliver the same features as other comparable frameworks with about 1/3 the lines of code.
It offers two types of reactive data stores:
- Entity stores (EStore
) for structured entity like data (Customer, Product, User, ...) - Entity stores can be "Live filtered" by adding slices. For example separating Todo entities into complete and incomplete compartments. Slices are also obserable.
- Object store (Key value store) for unstructured data
Even though Angular is used for prototype applications, it should work well for:
- Single page applications
- Progressive web applications
- React applications
- Node applications / Pure Javascript Applications
- Mobile Applications
Build
Run npm run c
to build the project. The build artifacts will be stored in the dist/
directory.
Running unit tests
Run ng test
to execute the unit tests via Jest.
Features
- Live Stackblitz demoes
- Typedoc with inlined examples
- Well documented test cases run with Jest - Each file has a corresponding
.spec
file - Stream both Entity and Object Stores for UI Updates via RxJS
- Define entities using Typescript classes, interfaces, or types
- Active state tracking
- Supports for Optimistic User Interfaces
- RESTful API for performing CRUD operations that stream both full and delta updates
- Dynamic creation of both object and entity stores
- Observable delta updates for Entities
- Real time application of Slice
Predicate<E>
filtering that isObservable
Predicate
based snapshots of entities- Observable
count
of entities in the entity store. Thecount
feature can also bePredicate
filtered. - Configurable global id (Client side id -
gid
) and server id (id
) id property names for entities. - The stream of entities can be sorted via an optional boolean expression passed to
observe
.
Stackblitz Todo Entity Store Demo
https://stackblitz.com/edit/slice-todo-1329
Tests
See the test cases.