Derived

Class: Derived<TState, TArr>

Type Parameters

TState

TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>

Constructors

new Derived()

ts
new Derived<TState, TArr>(options): Derived<TState, TArr>
new Derived<TState, TArr>(options): Derived<TState, TArr>

Parameters

options

DerivedOptions<TState, TArr>

Returns

Derived<TState, TArr>

Defined in

derived.ts:87

Properties

lastSeenDepValues

ts
lastSeenDepValues: unknown[] = [];
lastSeenDepValues: unknown[] = [];

Defined in

derived.ts:71


listeners

ts
listeners: Set<Listener<TState>>;
listeners: Set<Listener<TState>>;

Defined in

derived.ts:60


options

ts
options: DerivedOptions<TState, TArr>;
options: DerivedOptions<TState, TArr>;

Defined in

derived.ts:63


prevState

ts
prevState: undefined | TState;
prevState: undefined | TState;

Defined in

derived.ts:62


state

ts
state: TState;
state: TState;

Defined in

derived.ts:61

Methods

checkIfRecalculationNeededDeeply()

ts
checkIfRecalculationNeededDeeply(): void
checkIfRecalculationNeededDeeply(): void

Returns

void

Defined in

derived.ts:157


getDepVals()

ts
getDepVals(): object
getDepVals(): object

Returns

object

currDepVals
ts
currDepVals: unknown[];
currDepVals: unknown[];
prevDepVals
ts
prevDepVals: unknown[];
prevDepVals: unknown[];
prevVal
ts
prevVal: undefined | NonNullable<TState>;
prevVal: undefined | NonNullable<TState>;

Defined in

derived.ts:72


mount()

ts
mount(): () => void
mount(): () => void

Returns

Function

Returns

void

Defined in

derived.ts:178


recompute()

ts
recompute(): void
recompute(): void

Returns

void

Defined in

derived.ts:145


registerOnGraph()

ts
registerOnGraph(deps): void
registerOnGraph(deps): void

Parameters

deps

readonly (Derived<any, readonly any[]> | Store<any, (cb) => any>)[] = ...

Returns

void

Defined in

derived.ts:96


subscribe()

ts
subscribe(listener): () => void
subscribe(listener): () => void

Parameters

listener

Listener<TState>

Returns

Function

Returns

void

Defined in

derived.ts:190


unregisterFromGraph()

ts
unregisterFromGraph(deps): void
unregisterFromGraph(deps): void

Parameters

deps

readonly (Derived<any, readonly any[]> | Store<any, (cb) => any>)[] = ...

Returns

void

Defined in

derived.ts:125

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.