2.0.5 • Published 3 years ago

behavior-subject-entities v2.0.5

Weekly downloads
63
License
ISC
Repository
-
Last release
3 years ago

Behavior Subject Entitites

Code Style: Google

Jest Build Coverage ESLint

Description

Behavior Subject Entitites is a helper class designed to be used in place of a standard BehaviorSubject(). It includes all CRUD functions to make dealing with adding, removing, and deleting easier.

Installation

  • Install the package

    npm install behavior-subject-entities --save

Use

  • Import it in a TS file

import { EntityClass } from 'behavior-subject-entities';

Demo

export class TestService extends EntityClass<T>

  • Options 2: add it as a variable to a class

subject = new EntityClass<T>();

Options

EntityClass accepts a few options

KeyRequiredTypeDefault ValueDescription
keyfalseIdSelector(instance: any) => instance.idId selector for the Entity. Pass a new function if you do not use id
namefalsestringItemThe Single Name for the Entity
pluralfalsestringItemsThe Plural Name for the Entity

Methods

MethodParametersReturn
data\$N/AObservable<EntityObjContainer<T>>
items\$N/AObservable<T[]>
activeId\$N/AObservable<string>
addOneitem: Tvoid
addManyarr: T[]void
getOneid: stringObservable<T>
getManyids: string[]Observable<T[]>
updateOneitem: Tvoid
updateManyarr: Tvoid
removeOneid: stringvoid
removeManyids: string[]void
snapshotN/AEntitySnapshot<T>
setActiveIdid: stringvoid
2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.6

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago