@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Interface HostedServiceCollection<TUses>

    Records long-lived Application work. Start order is declaration order; stop order is the reverse, and the same injected instances are passed to both. Background loops must observe context.signal; the Host observes their promise and waits for settlement only within the shared shutdown budget. Non-cooperative work can outlive that budget.

    The dependency-declaring overload is listed first: overload resolution takes the first match, and the no-dependency shape would otherwise absorb the call and leave the callback parameters untyped.

    interface HostedServiceCollection<
        TUses extends ServiceMap = Record<never, never>,
    > {
        add<TMap extends Readonly<Record<string, ServiceToken<unknown>>>>(
            definition: {
                id: string;
                inject: TMap;
                start?: (
                    context: HostedServiceContext,
                    injected: Injected<TUses & TMap>,
                ) => void | Promise<void>;
                stop?: (
                    context: HostedServiceStopContext,
                    injected: Injected<TUses & TMap>,
                ) => void | Promise<void>;
            },
        ): void;
        add(
            definition: {
                id: string;
                start?: (context: HostedServiceContext) => void | Promise<void>;
                stop?: (context: HostedServiceStopContext) => void | Promise<void>;
            },
        ): void;
        background<TMap extends Readonly<Record<string, ServiceToken<unknown>>>>(
            definition: {
                id: string;
                inject: TMap;
                run: (
                    context: HostedServiceContext,
                    injected: Injected<TUses & TMap>,
                ) => void | Promise<void>;
            },
        ): void;
        background(
            definition: {
                id: string;
                run: (context: HostedServiceContext) => void | Promise<void>;
            },
        ): void;
    }

    Type Parameters

    Index
    • Adds a background loop with declared dependencies. A rejection is logged and diagnosed; it does not fail an already-running Application.

      Type Parameters

      • TMap extends Readonly<Record<string, ServiceToken<unknown>>>

      Parameters

      Returns void

    • Adds a background loop with no dependencies. It starts during activation without blocking activation, but its rejection is observed and shutdown waits for it up to the remaining shared budget.

      Parameters

      Returns void