Optional options: KosMultipleFutureAwareOptionsConfiguration options for the decorator
A class decorator
aliases
Important: Use TypeScript interface merging to get proper type information:
// Add ESLint disable comment at top of file, then:
interface MyModelImpl extends KosMultipleFutureAwareFull<"operation1" | "operation2"> {}
@kosMultipleFutureAware()
class MyModelImpl implements IKosDataModel {
// All Future properties and named futures are now available with full type safety
}
Note: This decorator supports multiple concurrent Future operations. For models that only need single Future support, use
instead.
// Full mode example with multiple futures
interface IceAgitatorModelImpl extends KosMultipleFutureAwareFull<"pour" | "agitate" | "gate"> {}
@kosMultipleFutureAware()
class IceAgitatorModelImpl implements IKosDataModel {
get isPouring() {
return !!(this.pourFuture && !this.pourFuture?.endState);
}
onFutureUpdate?(future: IFutureModel): void {
// Handle Future updates from any operation
}
@kosFuture({ alias: "pour" })
async pourIce(): Promise<void> {
// Pour operation
}
@kosFuture({ alias: "agitate" })
async testAgitate(): Promise<void> {
// Agitation operation
}
}
// Minimal mode example
interface BackgroundServiceModelImpl extends KosMultipleFutureAwareMinimal<"task1" | "task2"> {}
@kosMultipleFutureAware({ mode: 'minimal' })
class BackgroundServiceModelImpl implements IKosDataModel {
@kosFuture({ alias: "task1" })
async backgroundTask1() {
return "done";
}
@kosFuture({ alias: "task2" })
async backgroundTask2() {
return "done";
}
}
2.0.0
Class decorator that automatically adds Multiple Future Container capabilities to a KOS model.
This decorator eliminates the need for manual MultipleFutureHandler setup by: