eventEmitter.InjectableNopeEventEmitter - ZeMA-gGmbH/NoPE-JS GitHub Wiki
eventEmitter.InjectableNopeEventEmitter
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 |
-
NopeEventEmitter<T,S,G>↳
InjectableNopeEventEmitter
new InjectableNopeEventEmitter<T, S, G>(_options?)
| Name | Type |
|---|---|
T |
T |
S |
T |
G |
T |
| Name | Type |
|---|---|
_options |
TSubjectOptions |
_subscriptions: Set<() => void>
A Set containing the Subscriptions
NopeEventEmitter._subscriptions
disablePublishing: boolean = false
Flag to Disable Publishing
NopeEventEmitter.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
NopeEventEmitter.getter
set getter(_getter): void
| Name | Type |
|---|---|
_getter |
(value: T) => G
|
void
NopeEventEmitter.getter
get hasSubscriptions(): boolean
Flag, showing if there exists any subscription this particular observer.
boolean
NopeEventEmitter.hasSubscriptions
get observerLength(): number
Returns the amout of interessed Subscribers / Observers.
number
NopeEventEmitter.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
NopeEventEmitter.enhancedSubscription
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 |
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>