• Composition helper that works with

    Type Parameters

    • T extends IKosDataModel

    Parameters

    • model: T

    Returns KosModelFutureContainerMixin<Record<string, unknown>>

    Kos Model

    Use this if you prefer composition over setup function

    Example

    Example usage:

    @kosModel("my-model")
    export class MyModel implements IKosDataModel, FutureContainer {
    id: string;
    private futures = createKosModelFutureManager(this);

    // Delegate FutureContainer interface
    get futureHandler() { return this.futures.futureHandler; }
    get future() { return this.futures.future; }
    get progress() { return this.futures.progress; }
    get status() { return this.futures.status; }
    get isRunning() { return this.futures.isRunning; }
    get isCancelled() { return this.futures.isCancelled; }
    async cancelFuture() { return this.futures.cancelFuture(); }

    constructor(modelId: string, options: any, context: KosCreationContext) {
    this.id = modelId;
    }

    async performOperation() { return "done"; }
    unload() {}
    }