observables.InjectableNopeObservable - ZeMA-gGmbH/NoPE-JS GitHub Wiki

Class: InjectableNopeObservable<T, S, G>

observables.InjectableNopeObservable

RsJX based Observable.

Contains additional Functionalities like:

  • property with the current value
  • function to publish values. (wrapper for next)
  • enables performing a subscription with synced call or a immediate call.

Type parameters

Name Type
T T
S T
G T

Hierarchy

Constructors

constructor

new InjectableNopeObservable<T, S, G>(_options?)

Type parameters

Name Type
T T
S T
G T

Parameters

Name Type
_options TSubjectOptions

Inherited from

NopeObservable.constructor

Properties

_subscriptions

_subscriptions: Set<() => void>

A Set containing the Subscriptions

Inherited from

NopeObservable._subscriptions


_value

_value: T

Accessor to the currently stored value.

Inherited from

NopeObservable._value


disablePublishing

disablePublishing: boolean = false

Flag to Disable Publishing

Inherited from

NopeObservable.disablePublishing


id

Readonly id: string

An id of the Observable. This might be usefull for debugging.

Inherited from

NopeObservable.id


options

options: any

options.

Inherited from

NopeObservable.options


setter

setter: (value: S, options?: Partial<IEventAdditionalData>) => { data: T ; valid: boolean } = null

Type declaration

(value, options?): Object

Function to specify a Setter

Parameters
Name Type
value S
options? Partial<IEventAdditionalData>
Returns

Object

Name Type
data T
valid boolean

Inherited from

NopeObservable.setter

Accessors

getter

get getter(): (value: T) => G

Returns

fn

(value): G

Parameters
Name Type
value T
Returns

G

Inherited from

NopeObservable.getter

set getter(_getter): void

Parameters

Name Type
_getter (value: T) => G

Returns

void

Inherited from

NopeObservable.getter


hasSubscriptions

get hasSubscriptions(): boolean

Flag, showing if there exists any subscription this particular observer.

Returns

boolean

Inherited from

NopeObservable.hasSubscriptions


observable

get observable(): BehaviorSubject<IObservableType<G, AD>>

The original Observable. Implemented by an Behaviour Subject. See here: https://www.learnrxjs.io/learn-rxjs/subjects/behaviorsubject for more details.

Returns

BehaviorSubject<IObservableType<G, AD>>

Inherited from

NopeObservable.observable


observerLength

get observerLength(): number

Returns the amout of interessed Subscribers / Observers.

Returns

number

Inherited from

NopeObservable.observerLength

Methods

dispose

dispose(): void

Function, used to dispose the observable. Every item will be unsubscribed.

Returns

void

Inherited from

NopeObservable.dispose


emit

emit(value, options?): boolean

Function to update the Content

Parameters

Name Type Description
value S The content
options Partial<IEventAdditionalData> -

Returns

boolean

Inherited from

NopeObservable.emit


enhancedSubscription

enhancedSubscription<K>(next, options?): Subscription

Create an enhanced Subscription of the Observable. Use the Pipes, to Define what should be subscribed.

Type parameters

Name
K

Parameters

Name Type Description
next (data: K) => void The Next Function, used to transmit changes
options Object The Options, used to determine the Enhancements.
options.pipe? IPipe<T | G, K> -
options.scope? Object -

Returns

Subscription

Inherited from

NopeObservable.enhancedSubscription


forcePublish

forcePublish(options?): boolean

Function to Force an Update

Author

M.Karkowski

Memberof

NopeObservable

Parameters

Name Type Description
options Partial<IEventAdditionalData> Options which might be relevant

Returns

boolean

Inherited from

NopeObservable.forcePublish


getContent

getContent(): G

Function to extract the Content. If a Getter is provided, the Getter will be used to Transform the item.

Returns

G

Inherited from

NopeObservable.getContent


once

once(func, options?): INopeObserver

Creates a Subscription for the value of the Observable. After one Update the Value will be deleted

Parameters

Name Type Description
func IEventCallback<G, IEventAdditionalData> Function which is called when new Datas are pushed
options? INopeSubscriptionOptions Additional Options

Returns

INopeObserver

Inherited from

NopeObservable.once


setContent

setContent(value, options?): boolean

Function to update the Content

Parameters

Name Type Description
value S The content
options Partial<IEventAdditionalData> -

Returns

boolean

Inherited from

NopeObservable.setContent


subscribe

subscribe(observer, options?): INopeObserver

A Function to subscribe to updates of the Observable.

Parameters

Name Type Description
observer INopePartialObserver<G, IEventAdditionalData> | IEventCallback<G, IEventAdditionalData> The Observer. Could be a Function or a Partial Observer.
options INopeSubscriptionOptions Additional Options.

Returns

INopeObserver

Inherited from

NopeObservable.subscribe


waitFor

waitFor(testCallback?, options?): Promise<G>

Async Function to Wait for an Update

Parameters

Name Type Description
testCallback IWaitForCallback<G, IEventAdditionalData> -
options INopeWaitForObservableChangeOptions Additional Options for the Wait Function.

Returns

Promise<G>

Inherited from

NopeObservable.waitFor


waitForUpdate

waitForUpdate(options?): Promise<G>

Async Function to Wait for an Update

Parameters

Name Type Description
options? INopeSubscriptionOptions Additional Options for the Wait Function.

Returns

Promise<G>

Inherited from

NopeObservable.waitForUpdate

⚠️ **GitHub.com Fallback** ⚠️