/** * command.ts * Copyright (C) 2021 * * @author Edgard Leal * @module command.ts */ export default abstract class Command { private nextCommand: Command; set next(value: Command) { this.nextCommand = value; } async runNext(context: T): Promise { if (this.nextCommand) { return this.nextCommand.run(context); } return context; } abstract run(context: T): Promise; }