observables.InjectableNopeObservable - ZeMA-gGmbH/NoPE-JS GitHub Wiki
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.
| Name | Type |
|---|---|
T |
T |
S |
T |
G |
T |
-
NopeObservable<T,S,G>↳
InjectableNopeObservable
new InjectableNopeObservable<T, S, G>(_options?)
| Name | Type |
|---|---|
T |
T |
S |
T |
G |
T |
| Name | Type |
|---|---|
_options |
TSubjectOptions |
_subscriptions: Set<() => void>
A Set containing the Subscriptions
_value: T
Accessor to the currently stored value.
disablePublishing: boolean = false
Flag to Disable Publishing
NopeObservable.disablePublishing
Readonly id: string
An id of the Observable. This might be usefull for debugging.
options: any
options.
setter: (value: S, options?: Partial<IEventAdditionalData>) => { data: T ; valid: boolean } = null
(value, options?): Object
Function to specify a Setter
| Name | Type |
|---|---|
value |
S |
options? |
Partial<IEventAdditionalData> |
Object
| Name | Type |
|---|---|
data |
T |
valid |
boolean |
get getter(): (value: T) => G
fn
(value): G
| Name | Type |
|---|---|
value |
T |
G
NopeObservable.getter
set getter(_getter): void
| Name | Type |
|---|---|
_getter |
(value: T) => G
|
void
NopeObservable.getter
get hasSubscriptions(): boolean
Flag, showing if there exists any subscription this particular observer.
boolean
NopeObservable.hasSubscriptions
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.
BehaviorSubject<IObservableType<G, AD>>
NopeObservable.observable
get observerLength(): number
Returns the amout of interessed Subscribers / Observers.
number
NopeObservable.observerLength
dispose(): void
Function, used to dispose the observable. Every item will be unsubscribed.
void
emit(value, options?): boolean
Function to update the Content
| Name | Type | Description |
|---|---|---|
value |
S |
The content |
options |
Partial<IEventAdditionalData> |
- |
boolean
enhancedSubscription<K>(next, options?): Subscription
Create an enhanced Subscription of the Observable. Use the Pipes, to Define what should be subscribed.
| Name |
|---|
K |
| 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 |
- |
Subscription
NopeObservable.enhancedSubscription
forcePublish(options?): boolean
Function to Force an Update
Author
M.Karkowski
Memberof
NopeObservable
| Name | Type | Description |
|---|---|---|
options |
Partial<IEventAdditionalData> |
Options which might be relevant |
boolean
getContent(): G
Function to extract the Content. If a Getter is provided, the Getter will be used to Transform the item.
G
once(func, options?): INopeObserver
Creates a Subscription for the value of the Observable. After one Update the Value will be deleted
| Name | Type | Description |
|---|---|---|
func |
IEventCallback<G, IEventAdditionalData> |
Function which is called when new Datas are pushed |
options? |
INopeSubscriptionOptions |
Additional Options |
setContent(value, options?): boolean
Function to update the Content
| Name | Type | Description |
|---|---|---|
value |
S |
The content |
options |
Partial<IEventAdditionalData> |
- |
boolean
subscribe(observer, options?): INopeObserver
A Function to subscribe to updates of the Observable.
| Name | Type | Description |
|---|---|---|
observer |
INopePartialObserver<G, IEventAdditionalData> | IEventCallback<G, IEventAdditionalData> |
The Observer. Could be a Function or a Partial Observer. |
options |
INopeSubscriptionOptions |
Additional Options. |
waitFor(testCallback?, options?): Promise<G>
Async Function to Wait for an Update
| Name | Type | Description |
|---|---|---|
testCallback |
IWaitForCallback<G, IEventAdditionalData> |
- |
options |
INopeWaitForObservableChangeOptions |
Additional Options for the Wait Function. |
Promise<G>
waitForUpdate(options?): Promise<G>
Async Function to Wait for an Update
| Name | Type | Description |
|---|---|---|
options? |
INopeSubscriptionOptions |
Additional Options for the Wait Function. |
Promise<G>