All files / src/classes CorePresenter.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45                                                                      1x                  
import type {
  ICoreCache,
  ICoreClient,
  ICoreKernel,
  ICoreKernelModule,
  ICorePresenter,
  IDataBase,
} from '../lib';
import CoreElement from './CoreElement';
 
/**
 * Base class for presenters within the Core framework.
 *
 * @template A    The type of application instance managed by the presenter.
 * @template K    The kernel type. Defaults to {@link ICoreKernel<any>}.
 * @template T    The data‑base type or {@code null}. Defaults to {@code any}.
 * @template P    The client type or {@code null}. Defaults to {@code any}.
 * @template C    The cache type or {@code null}. Defaults to {@code any}.
 * @template E    The parent presenter type or {@code null}. Defaults to {@code any}.
 */
export default abstract class CorePresenter<
    A,
    K extends ICoreKernel<any> = ICoreKernel<any>,
    T extends IDataBase<any, any> | null = any,
    P extends ICoreClient | null = any,
    C extends ICoreCache | null = any,
    E extends ICorePresenter<any> | null = any,
  >
  extends CoreElement<K, T, P, C, E>
  implements ICorePresenter<A, K, T, P, C, E>
{
  constructor(
    channel: string,
    module: ICoreKernelModule<any, any, any, any, any>,
  ) {
    super(`presenter-${channel}`, module);
  }
 
  abstract start(): Promise<boolean>;
 
  abstract stop(): Promise<boolean>;
 
  abstract getApp(): A;
}