@rollinsafary/mvc
Version:
Extended mvc design pattern implementation
23 lines (22 loc) • 1.35 kB
TypeScript
import { FunctionArgs } from "../../common/general";
import Notifier from "../observer/Notifier";
import Guard from "./Guard";
export default abstract class SimpleCommand extends Notifier {
guards: Guard[];
isChecked: boolean;
protected failedGuards: string[];
protected approvedGuards: string[];
constructor();
startCommandExecution<A extends FunctionArgs>(notificationName?: string, ...args: A): Promise<void>;
abstract execute<A extends FunctionArgs>(notificationName?: string, ...args: A): void;
protected onAnyGuardApproved<A extends FunctionArgs>(notificationName?: string, ...args: A): void;
protected onAnyGuardDenied<A extends FunctionArgs>(notificationName?: string, ...args: A): void;
protected onAllGuardsDenied<A extends FunctionArgs>(notificationName?: string, ...args: A): void;
protected prepare?(): void;
protected addGuards<G extends Guard>(...guardClassRefs: (new () => G)[]): void;
protected sendNotification<A extends FunctionArgs>(notificationName: string, ...args: A): void;
protected startExecution<A extends FunctionArgs>(notificationName: string, ...args: A): void;
protected checkGuards<A extends FunctionArgs>(notificationName: string, ...args: A): Promise<void>;
protected get failedGuardsCount(): number;
protected get approvedGuardsCount(): number;
}