UNPKG

@tsed/platform-http

Version:
21 lines (20 loc) 479 B
import { AnyToPromise } from "@tsed/core"; export class AnyToPromiseWithCtx extends AnyToPromise { constructor($ctx) { super(); this.$ctx = $ctx; } isDone() { const { $ctx } = this; return $ctx?.isDone() || super.isDone(); } call(cb) { return super.call(() => cb(this)); } destroy() { this.$ctx = null; } isCanceledResponse(process) { return process === this.$ctx.getResponse(); } }