mapObservableToChunkIterator(observable, mapValueToChunks, mapErrorToChunks?): Generator<Promise | Chunk[]>
A function that accepts an Observable with a subscribe()
method, and optionally with a getCurrentValue()
or getCurrentResult()
method.
It returns a Generator that yields Promise (when waiting for a new value) or Chunk objects (i.e. objects that extend { type: string }).
By default, mapErrorToChunks
takes the error emitted by an observable, and yields [{ type: 'error', error: error }]
.
When the observable is complete, the Generator's next()
function will return { done: true }
.