Push Overview
Push Lines are based on Observers (which are a sub-type of Coroutines):
interface Observer<T> { next(value : T): void; return?(): void; throw?(error): void;}Push is used less often than Pull and has an independent implementation. Push Lines are not re-usable and you must close the observer when you're done with it by calling its .return() method. Closing the observer also signals end-of-sequence (many operations wait till they gather all items, until they could continue). The .throw() method allows to cancel execution at any time.
To use Push Lines you need to import from @undercut/push entry point.
Terms in releation to Push Lines:
observer-- an object implementing theObserver protocol.operation-- a function taking anobserveraccepting result items and returning anobserveraccepting source items.pipeline-- an ordered sequence (array) ofoperations.source-- there is no realsourceinPush Lines, because someone need to manually put items into theobserver, but severalpushfunctions can help you to processiterableswithPush Lines.target-- anobserverthat will receive the result.
type PushOperation = <T, R>(observer: Observer<T>) => Observer<R>;
type PullPipeline = Array<PushOperation>;
type PushTarget = Observer<T>;