ai-subject
Send values to an async iterable like Reactive Extensions does. This multicasts values to be multicasted to many listeners. The listener would be anything that retrieves an iterator via the [Symbol.asyncIterator]()
method. Subjects are like EventEmitters.
Usage
const aiSubject = new AiSubject()
Creates a new instance of AiSubject
.
aiSubject[Symbol.asyncIterator]()
Listens to the subject until it finishes.
Returns:
AsyncIterable & AsyncIterator
- An iterator that listens to values sent to the subject.
Note: The subject will only emit values sent via onNext
if the iterator is listened to.
aiSubject.onNext(value)
Sends a new value to all of the subject's listeners.
Parameters:
value
- The value
aiSubject.onEnd()
Ends the subject.
aiSubject.onError(error)
Transitions the subject to an error state.
Parameters:
error
- The error.