import { EvtCore } from "./EvtCore"; import { Handler } from "./types/Handler"; import { Operator } from "./types/Operator"; import { Ctx } from "./Ctx"; import { invokeOperator } from "./util/invokeOperator"; import { merge } from "./util/merge"; import { from } from "./util/fromEvent"; import { parseOverloadParamsFactory } from "./util/parseOverloadParams"; import { getLazyEvtFactory } from "./util/getLazyEvtFactory"; import { getCtxFactory } from "./util/getCtxFactory"; type VoidCtx = import("./Ctx").VoidCtx; export class Evt extends EvtCore { /** return a new Ctx instance */ //public static newCtx(): VoidCtx; public static newCtx(): T extends void ? VoidCtx : Ctx{ return new Ctx() as any; } /** * Evt.weakCtx(obj) always return the same instance of VoidCtx for a given object. * No strong reference to the object is created * when the object is no longer referenced it's associated Ctx will be freed from memory. */ public static readonly getCtx = getCtxFactory(); public static merge = merge; public static from = from; public readonly getEvtAttach: () => Evt>; public readonly getEvtDetach: () => Evt>; constructor() { super(); const { getEvt: getEvtAttach, post: postEvtAttach } = getLazyEvtFactory>(); const { getEvt: getEvtDetach, post: postEvtDetach } = getLazyEvtFactory>(); this.onHandler = (isAttach, handler) => (isAttach ? postEvtAttach : postEvtDetach)(handler) ; this.getEvtAttach = getEvtAttach; this.getEvtDetach = getEvtDetach; } public async postAsyncOnceHandled(data: T) { return this.__postOnceHandled(data, false); } public async postSyncOnceHandled(data: T) { return this.__postOnceHandled(data, true); } private __postOnceHandled(data: T, isSync: boolean): number | Promise { if (this.isHandled(data)) { return this.post(data); } let resolvePr: (postCount: number) => void; const pr = new Promise(resolve => resolvePr = resolve); const resolvePrAndPost = (data: T) => resolvePr(this.post(data)); this.getEvtAttach().attachOnce( ({ op }) => !!invokeOperator(this.getStatelessOp(op), data), () => isSync ? resolvePrAndPost(data) : Promise.resolve().then(() => resolvePrAndPost(data)) ); return pr; } private __parseOverloadParams = parseOverloadParamsFactory(); public pipe(): Evt; public pipe( op: Operator.fλ ): Evt; public pipe( op: (data: T) => data is U ): Evt; public pipe( op: (data: T) => boolean ): Evt; public pipe(ctx: Ctx): Evt; public pipe( ctx: Ctx, op: Operator.fλ ): Evt; public pipe( ctx: Ctx, op: (data: T) => data is U ): Evt; public pipe( ctx: Ctx, op: (data: T) => boolean ): Evt; public pipe( op1: Operator.fλ, op2: Operator.fλ ): Evt; public pipe( op1: Operator.fλ, op2: (data: B) => data is C ): Evt; public pipe( op1: Operator.fλ, op2: (data: B) => boolean ): Evt; public pipe( op1: (data: T) => data is B, op2: Operator.fλ ): Evt; public pipe( op1: (data: T) => boolean, op2: Operator.fλ ): Evt; public pipe( op1: (data: T) => data is B, op2: (data: B) => data is C ): Evt; public pipe( op1: (data: T) => data is B, op2: (data: B) => boolean ): Evt; public pipe( op1: (data: T) => boolean, op2: (data: T) => data is B ): Evt; public pipe( op1: (data: T) => boolean, op2: (data: T) => boolean ): Evt; public pipe( op1: Operator.fλ, op2: Operator.fλ, op3: Operator.fλ ): Evt; public pipe( op1: Operator.fλ, op2: Operator.fλ, op3: Operator.fλ, op4: Operator.fλ ): Evt; public pipe( op1: Operator.fλ, op2: Operator.fλ, op3: Operator.fλ, op4: Operator.fλ ): Evt; public pipe( op1: Operator.fλ, op2: Operator.fλ, op3: Operator.fλ, op4: Operator.fλ, op5: Operator.fλ ): Evt; public pipe( op1: Operator, op2: Operator ): Evt; public pipe( op1: Operator, op2: Operator, op3: Operator ): Evt; public pipe( op1: Operator, op2: Operator, op3: Operator, op4: Operator ): Evt; public pipe( op1: Operator, op2: Operator, op3: Operator, op4: Operator, op5: Operator ): Evt; public pipe( ...ops: [ Operator, ...Operator[] ] ): Evt; public pipe( ...ops: [ Operator, ...Operator[] ] ): Evt; public pipe(...inputs: any[]): Evt { const evtDelegate = new Evt(); this.__attach( { ...this.__parseOverloadParams(inputs, "pipe"), "callback": (transformedData: any) => evtDelegate.post(transformedData) } ); return evtDelegate; } /** * op - fλ * * ctx * * timeout? */ public waitFor( op: Operator.fλ.Stateless, ctx: Ctx, timeout?: number ): Promise; /** * op - Type guard * * ctx * * timeout? */ public waitFor( op: (data: T) => data is Q, ctx: Ctx, timeout?: number ): Promise; /** * op - Filter * * ctx * * timeout? */ public waitFor( op: (data: T) => boolean, ctx: Ctx, timeout?: number ): Promise; /** * op - fλ * * timeout? */ public waitFor( op: Operator.fλ.Stateless, timeout?: number ): Promise; /** * op - Type guard * * timeout? */ public waitFor( op: (data: T) => data is Q, timeout?: number ): Promise; /** * op - Filter * * timeout? */ public waitFor( op: (data: T) => boolean, timeout?: number ): Promise; /** * ctx * * timeout? */ public waitFor( ctx: Ctx, timeout?: number ): Promise; /** * timeout? */ public waitFor( timeout?: number ): Promise; public waitFor(...inputs: any[]) { return super.__waitFor(this.__parseOverloadParams(inputs, "waitFor")); } /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * timeout * * callback */ public $attach( op: Operator.fλ, ctx: Ctx, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * callback */ public $attach( op: Operator.fλ, ctx: Ctx, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * timeout * * callback */ public $attach( op: Operator.fλ, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * callback */ public $attach( op: Operator.fλ, callback: (transformedData: U) => void ): Promise; public $attach(...inputs: any[]) { return (this.attach as any)(...inputs); } /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Type guard * * ctx * * timeout * * callback */ public attach( op: (data: T) => data is Q, ctx: Ctx, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Filter * * ctx * * timeout * * callback */ public attach( op: (data: T) => boolean, ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Type guard * * ctx * * callback */ public attach( op: (data: T) => data is Q, ctx: Ctx, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Filter * * ctx * * callback */ public attach( op: (data: T) => boolean, ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Type guard * * timeout * * callback */ public attach( op: (data: T) => data is Q, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Filter * * timeout * * callback */ public attach( op: (data: T) => boolean, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * ctx * * timeout * * callback */ public attach( ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Type guard * * callback */ public attach( op: (data: T) => data is Q, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Filter * * callback */ public attach( op: (data: T) => boolean, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * ctx * * callback */ public attach( ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * timeout * * callback */ public attach( timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * callback */ public attach( callback: (data: T) => void ): Promise; public attach(...inputs: any[]) { return this.__attach(this.__parseOverloadParams(inputs, "attach*")); } /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * timeout * * callback */ public $attachOnce( op: Operator.fλ.Stateless, ctx: Ctx, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * callback */ public $attachOnce( op: Operator.fλ.Stateless, ctx: Ctx, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * timeout * * callback */ public $attachOnce( op: Operator.fλ.Stateless, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * callback */ public $attachOnce( op: Operator.fλ.Stateless, callback: (transformedData: U) => void ): Promise; public $attachOnce(...inputs: any[]) { return (this.attachOnce as any)(...inputs); } /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Type guard * * ctx * * timeout * * callback */ public attachOnce( op: (data: T) => data is Q, ctx: Ctx, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Filter * * ctx * * timeout * * callback */ public attachOnce( op: (data: T) => boolean, ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Type guard * * ctx * * callback */ public attachOnce( op: (data: T) => data is Q, ctx: Ctx, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Filter * * ctx * * callback */ public attachOnce( op: (data: T) => boolean, ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Type guard * * timeout * * callback */ public attachOnce( op: (data: T) => data is Q, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Filter * * timeout * * callback */ public attachOnce( op: (data: T) => boolean, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * ctx * * timeout * * callback */ public attachOnce( ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Type guard * * callback */ public attachOnce( op: (data: T) => data is Q, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * op - Filter * * callback */ public attachOnce( op: (data: T) => boolean, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * ctx * * callback */ public attachOnce( ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * timeout * * callback */ public attachOnce( timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattach-evtattachonce-and-evtpostdata * * callback */ public attachOnce( callback: (data: T) => void ): Promise; public attachOnce(...inputs: any[]) { return this.__attachOnce(this.__parseOverloadParams(inputs, "attach*")); } /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * timeout * * callback */ public $attachExtract( op: Operator.fλ, ctx: Ctx, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * callback */ public $attachExtract( op: Operator.fλ, ctx: Ctx, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * timeout * * callback */ public $attachExtract( op: Operator.fλ, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * callback */ public $attachExtract( op: Operator.fλ, callback: (transformedData: U) => void ): Promise; public $attachExtract(...inputs: any[]) { return (this.attachOnceExtract as any)(...inputs); } /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Type guard * * ctx * * timeout * * callback */ public attachExtract( op: (data: T) => data is Q, ctx: Ctx, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - fλ * * ctx * * timeout * * callback */ public attachExtract( op: (data: T) => boolean, ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Type guard * * ctx * * callback */ public attachExtract( op: (data: T) => data is Q, ctx: Ctx, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Filter * * ctx * * callback */ public attachExtract( op: (data: T) => boolean, ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Type guard * * timeout * * callback */ public attachExtract( op: (data: T) => data is Q, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Filter * * timeout * * callback */ public attachExtract( op: (data: T) => boolean, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Type guard * * callback */ public attachExtract( op: (data: T) => data is Q, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Filter * * callback */ public attachExtract( op: (data: T) => boolean, callback: (data: T) => void ): Promise; public attachExtract(...inputs: any[]) { return this.__attachExtract(this.__parseOverloadParams(inputs, "attach*")); } /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * timeout * * callback */ public $attachPrepend( op: Operator.fλ, ctx: Ctx, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * callback */ public $attachPrepend( op: Operator.fλ, ctx: Ctx, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * timeout * * callback */ public $attachPrepend( op: Operator.fλ, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * callback */ public $attachPrepend( op: Operator.fλ, callback: (transformedData: U) => void ): Promise; public $attachPrepend(...inputs: any[]) { return (this.attachPrepend as any)(...inputs); } /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * op - Type guard * * ctx * * timeout * * callback */ public attachPrepend( op: (data: T) => data is Q, ctx: Ctx, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * op - Filter * * ctx * * timeout * * callback */ public attachPrepend( op: (data: T) => boolean, ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * op - Type guard * * ctx * * callback */ public attachPrepend( op: (data: T) => data is Q, ctx: Ctx, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * op - Filter * * ctx * * callback */ public attachPrepend( op: (data: T) => boolean, ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * op - Type guard * * timeout * * callback */ public attachPrepend( op: (data: T) => data is Q, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * op - Filter * * timeout * * callback */ public attachPrepend( op: (data: T) => boolean, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * ctx * * timeout * * callback */ public attachPrepend( ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * op - Type guard * * callback */ public attachPrepend( op: (data: T) => data is Q, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * op - Filter * * callback */ public attachPrepend( op: (data: T) => boolean, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * ctx * * callback */ public attachPrepend( ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * timeout * * callback */ public attachPrepend( timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and-evtattachonceprepend * * callback */ public attachPrepend( callback: (data: T) => void ): Promise; public attachPrepend(...inputs: any[]) { return this.__attachPrepend(this.__parseOverloadParams(inputs, "attach*")); } /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * timeout * * callback */ public $attachOncePrepend( op: Operator.fλ.Stateless, ctx: Ctx, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * callback */ public $attachOncePrepend( op: Operator.fλ.Stateless, ctx: Ctx, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * timeout * * callback */ public $attachOncePrepend( op: Operator.fλ.Stateless, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * callback */ public $attachOncePrepend( op: Operator.fλ.Stateless, callback: (transformedData: U) => void ): Promise; public $attachOncePrepend(...inputs: any[]) { return (this.attachOncePrepend as any)(...inputs); } /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * op - Type guard * * ctx * * timeout * * callback */ public attachOncePrepend( op: (data: T) => data is Q, ctx: Ctx, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * op - Filter * * ctx * * timeout * * callback */ public attachOncePrepend( op: (data: T) => boolean, ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * op - Type guard * * ctx * * callback */ public attachOncePrepend( op: (data: T) => data is Q, ctx: Ctx, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * op - Filter * * ctx * * callback */ public attachOncePrepend( op: (data: T) => boolean, ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * op - Type guard * * timeout * * callback */ public attachOncePrepend( op: (data: T) => data is Q, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * op - Filter * * timeout * * callback */ public attachOncePrepend( op: (data: T) => boolean, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * ctx * * timeout * * callback */ public attachOncePrepend( ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * op - Type guard * * callback */ public attachOncePrepend( op: (data: T) => data is Q, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * op - Filter * * callback */ public attachOncePrepend( op: (data: T) => boolean, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * ctx * * callback */ public attachOncePrepend( ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * timeout * * callback */ public attachOncePrepend( timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachprepend-and--evtattachonceprepend * * callback */ public attachOncePrepend( callback: (data: T) => void ): Promise; public attachOncePrepend(...inputs: any[]) { return this.__attachOncePrepend(this.__parseOverloadParams(inputs, "attach*")); } /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * timeout * * callback */ public $attachOnceExtract( op: Operator.fλ.Stateless, ctx: Ctx, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * ctx * * callback */ public $attachOnceExtract( op: Operator.fλ.Stateless, ctx: Ctx, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * timeout * * callback */ public $attachOnceExtract( op: Operator.fλ.Stateless, timeout: number, callback: (transformedData: U) => void ): Promise; /** * https://garronej.github.io/ts-evt/#op---fλ * * op - fλ * * callback */ public $attachOnceExtract( op: Operator.fλ.Stateless, callback: (transformedData: U) => void ): Promise; public $attachOnceExtract(...inputs: any[]) { return (this.attachOnceExtract as any)(...inputs); } /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Type guard * * ctx * * timeout * * callback */ public attachOnceExtract( op: (data: T) => data is Q, ctx: Ctx, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Filter * * ctx * * timeout * * callback */ public attachOnceExtract( op: (data: T) => boolean, ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Type guard * * ctx * * callback */ public attachOnceExtract( op: (data: T) => data is Q, ctx: Ctx, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Filter * * ctx * * callback */ public attachOnceExtract( op: (data: T) => boolean, ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Type guard * * timeout * * callback */ public attachOnceExtract( op: (data: T) => data is Q, timeout: number, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Filter * * timeout * * callback */ public attachOnceExtract( op: (data: T) => boolean, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * ctx * * timeout */ public attachOnceExtract( ctx: Ctx, timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Type guard * * callback */ public attachOnceExtract( op: (data: T) => data is Q, callback: (data: Q) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * op - Filter * * callback */ public attachOnceExtract( op: (data: T) => boolean, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * ctx * * callback */ public attachOnceExtract( ctx: Ctx, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * timeout * * callback */ public attachOnceExtract( timeout: number, callback: (data: T) => void ): Promise; /** * https://garronej.github.io/ts-evt/#evtattachextract-and-evtattachonceextract * * callback */ public attachOnceExtract( callback: (data: T) => void ): Promise; public attachOnceExtract(...inputs: any[]) { return this.__attachOnceExtract(this.__parseOverloadParams(inputs, "attach*")); } }