stack-subject

A stack, but as an Rxjs Subject


Project maintained by GerkinDev Hosted on GitHub Pages — Theme by mattgraham

stack-subject > StackSubject

Class: StackSubject

A stack subject.

see: Subject https://rxjs-dev.firebaseapp.com/guide/subject

Type parameters

T

The type of item contained by the StackSubject.

Hierarchy

Subject<T>

↳ StackSubject

Implements

Index

Constructors

Accessors

Methods


Constructors

constructor

new StackSubject(…items: T[]): StackSubject

Overrides Subject.__constructor

Defined in StackSubject.ts:20

Create a new observable, and eventually initialize it with some items.

Parameters:

Name Type Description
Rest items T[] The initial stack contained by the new StackSubject.

Returns: StackSubject


Accessors

length

getlength(): number

Defined in StackSubject.ts:18

Get the current number of items stacked in the observable.

Returns: number


value

getvalue(): undefined | T

Defined in StackSubject.ts:62

Retrieves the current value of the stack.

Returns: undefined | T


Methods

_subscribe

_subscribe(subscriber: Subscriber<T>): Subscription

Overrides Subject._subscribe

Defined in StackSubject.ts:51

DO NOT USE. This is an internal implementation.

Parameters:

Name Type Description
subscriber Subscriber<T> The function to execute on new values.

Returns: Subscription


next

next(value?: T): void

Overrides Subject.next

Defined in StackSubject.ts:42

DP NOT USE. This method will throw an error to force you to use the push or pushEach methods.

deprecated: You should not use this class, in favor of push or pushEach

Parameters:

Name Type Description
Optional value T Just don’t do it.

Returns: void


pop

pop(count?: number): this

Defined in StackSubject.ts:103

Pop items from the stack, and emit new current value.

Parameters:

Name Type Default value Description
Default value count number 1 The number of items to pop.

Returns: this


popEach

popEach(count?: number): this

Defined in StackSubject.ts:116

Pop items from the stack, and emit each popped value.

Parameters:

Name Type Default value Description
Default value count number 1 The number of items to pop.

Returns: this


push

push(…items: T[]): this

Defined in StackSubject.ts:78

Append items to the stack, and emit the last value.

Parameters:

Name Type Description
Rest items T[] Items to add at the end of the stack.

Returns: this


pushEach

pushEach(…items: T[]): this

Defined in StackSubject.ts:91

Append items to the stack, and emit each one of them

Parameters:

Name Type Description
Rest items T[] Items to add at the end of the stack.

Returns: this