Module

x/evt/lib/Evt.asyncPipe.ts>asyncPipe

šŸ’§EventEmitter's typesafe replacement
Go to Latest
function asyncPipe
import { asyncPipe } from "https://deno.land/x/evt@v2.3.1/lib/Evt.asyncPipe.ts";

NOTE: Workaround until v2.0 where .pipe() will support async operators Usage example: https://stackblitz.com/edit/evt-async-op?file=index.ts

When the argument is a StatefulEvt: If, wile asyncOp was running, the state of the source evt have changed then the result will be discarded.

If the asyncOp complete synchronously (meaning it does not return a promise) then the result is synchronously transformed. (As with .pipe() )

More usage example in src/test/test95.ts

Parameters

evt: E
asyncOp: (data: UnpackEvt<E>) => PromiseOrNot<[U] | null>

Returns

E extends StatefulReadonlyEvtLike<any> ? StatefulEvt<U | undefined> : Evt<U>