Module

x/evt/lib/index.ts>Ctx

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

Type Parameters

optional
Result = void

Properties

readonly
evtAttach: Evt<Handler.WithEvt<any, Result>>

https://docs.evt.land/api/ctx#ctx-evtattach

Posted every time a handler is bound to this context

readonly
evtDetach: Evt<Handler.WithEvt<any, Result>>

https://docs.evt.land/api/ctx#ctx-evtdetach

Posted every time a handler bound to this context is detached from it's Evt

readonly
completionStatus: DoneOrAborted<Result> | undefined

If .done() of .abort() has been called, returns the result or error of the call.

Methods

waitFor(timeout?: number): Promise<Result>

https://docs.evt.land/api/ctx#ctx-waitfor-timeout

Return a promise that resolve next time ctx.done(result) is invoked Reject if ctx.abort(error) is invoked. Optionally a timeout can be passed, if so the returned promise will reject with EvtError.Timeout if done(result) is not called within [timeout]ms. If the timeout is reached ctx.abort(timeoutError) will be invoked.

abort(error: Error): Handler.WithEvt<any, Result>[]

https://docs.evt.land/api/ctx#ctx-abort-error

All the handler will be detached. evtDone will post [Ā error, undefined, handlers (detached) ] if getPrDone() was invoked the promise will reject with the error

done(result: Result): Handler.WithEvt<any, Result>[]

https://docs.evt.land/api/ctx#ctx-done-result

Detach all handlers. evtDone will post [ null, result, handlers (detached) ] If getPrDone() was invoked the promise will result with result

zz__addHandler<T>(handler: Handler<T, any, CtxLike<Result>>, evt: NonPostableEvtLike<T>): void

Exposed to enable safe interoperability between mismatching EVT versions. Should be considered private

zz__removeHandler<T>(handler: Handler<T, any, CtxLike<Result>>): void

Exposed to enable safe interoperability between EVT versions. Should be considered private

type alias Ctx
import { type Ctx } from "https://deno.land/x/evt@v2.3.1/lib/index.ts";

Type Parameters

optional
Result = void
definition: import("./types/interfaces/index.ts").Ctx<Result>
variable Ctx
import { Ctx } from "https://deno.land/x/evt@v2.3.1/lib/index.ts";

type

{ readonly prototype: Ctx<any>; new <Result>(): Ctx<Result>; }