eventEmitter.NopeEventEmitter - ZeMA-gGmbH/NoPE-JS GitHub Wiki

Class: NopeEventEmitter<T, S, G, AD>

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.

Type parameters

Name Type
T unknown
S T
G T
AD extends IEventAdditionalData = IEventAdditionalData

Hierarchy

Implements

Constructors

constructor

new NopeEventEmitter<T, S, G, AD>(_options?)

Type parameters

Name Type
T unknown
S T
G T
AD extends IEventAdditionalData = IEventAdditionalData

Parameters

Name Type
_options TSubjectOptions

Properties

_subscriptions

_subscriptions: Set<() => void>

A Set containing the Subscriptions


disablePublishing

disablePublishing: boolean = false

Flag to Disable Publishing

Implementation of

INopeEventEmitter.disablePublishing


id

Readonly id: string

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

Implementation of

INopeEventEmitter.id


options

options: any

options.

Implementation of

INopeEventEmitter.options


setter

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

Type declaration

(value, options?): Object

Function to specify a Setter

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

Object

Name Type
data T
valid boolean

Implementation of

INopeEventEmitter.setter

Accessors

getter

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

Returns

fn

(value): G

Parameters
Name Type
value T
Returns

G

Implementation of

INopeEventEmitter.getter

set getter(_getter): void

Parameters

Name Type
_getter (value: T) => G

Returns

void

Implementation of

INopeEventEmitter.getter


hasSubscriptions

get hasSubscriptions(): boolean

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

Returns

boolean

Implementation of

INopeEventEmitter.hasSubscriptions


observerLength

get observerLength(): number

Returns the amout of interessed Subscribers / Observers.

Returns

number

Implementation of

INopeEventEmitter.observerLength

Methods

dispose

dispose(): void

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

Returns

void

Implementation of

INopeEventEmitter.dispose


emit

emit(value, options?): boolean

Function to update the Content

Parameters

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

Returns

boolean

Implementation of

INopeEventEmitter.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


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, AD> Function which is called when new Datas are pushed
options? INopeSubscriptionOptions Additional Options

Returns

INopeObserver

Implementation of

INopeEventEmitter.once


subscribe

subscribe(observer, options?): INopeObserver

A Function to subscribe to updates of the Observable.

Parameters

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

Returns

INopeObserver

Implementation of

INopeEventEmitter.subscribe


waitFor

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

Async Function to Wait for an Update

Parameters

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

Returns

Promise<G>

Implementation of

INopeEventEmitter.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>

Implementation of

INopeEventEmitter.waitForUpdate

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