@appsflow/redux
Version:
AppFlow redux
31 lines (23 loc) • 880 B
text/typescript
import { commandBases } from '@appsflow/core';
import Controller from "../controller";
// Since routes are only callback this wrapper will handle naming/calling of the command(route).
export class CommandRoute extends commandBases.CommandPublic {
private static controller: Controller;
private static command: typeof commandBases.CommandPublic;
public static setCommand( command: typeof commandBases.CommandPublic ) {
return this.command = command;
}
public static setController( controller: Controller ) {
this.controller = controller;
}
public static getController() {
return this.controller;
}
static getName() {
return this.command.name;
}
apply( args = {}, options = {} ) {
const Route = ( this.constructor as typeof CommandRoute );
return new Route( args, options );
}
}