eventEmitter.NopeEventEmitter - ZeMA-gGmbH/NoPE-JS GitHub Wiki
eventEmitter.NopeEventEmitter
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 |
unknown |
S |
T |
G |
T |
AD |
extends IEventAdditionalData = IEventAdditionalData
|
-
NopeEventEmitter
-
INopeEventEmitter<T,S,G,AD>
new NopeEventEmitter<T, S, G, AD>(_options?)
| Name | Type |
|---|---|
T |
unknown |
S |
T |
G |
T |
AD |
extends IEventAdditionalData = IEventAdditionalData
|
| Name | Type |
|---|---|
_options |
TSubjectOptions |
_subscriptions: Set<() => void>
A Set containing the Subscriptions
disablePublishing: boolean = false
Flag to Disable Publishing
INopeEventEmitter.disablePublishing
Readonly id: string
An id of the Observable. This might be usefull for debugging.
options: any
options.
setter: (value: S, options?: Partial<AD>) => { data: T ; valid: boolean } = null
(value, options?): Object
Function to specify a Setter
| Name | Type |
|---|---|
value |
S |
options? |
Partial<AD> |
Object
| Name | Type |
|---|---|
data |
T |
valid |
boolean |
get getter(): (value: T) => G
fn
(value): G
| Name | Type |
|---|---|
value |
T |
G
set getter(_getter): void
| Name | Type |
|---|---|
_getter |
(value: T) => G
|
void
get hasSubscriptions(): boolean
Flag, showing if there exists any subscription this particular observer.
boolean
INopeEventEmitter.hasSubscriptions
get observerLength(): number
Returns the amout of interessed Subscribers / Observers.
number
INopeEventEmitter.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<AD> |
- |
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
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, AD> |
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, AD> | IEventCallback<G, AD> |
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, AD> |
- |
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>