Files
audio-ui/lib/history/command.ts

39 lines
613 B
TypeScript
Raw Normal View History

/**
* Command Pattern for Undo/Redo System
*/
export interface Command {
/**
* Execute the command
*/
execute(): void;
/**
* Undo the command
*/
undo(): void;
/**
* Redo the command (default: call execute again)
*/
redo(): void;
/**
* Get a description of the command for UI display
*/
getDescription(): string;
}
/**
* Base command class with default redo implementation
*/
export abstract class BaseCommand implements Command {
abstract execute(): void;
abstract undo(): void;
abstract getDescription(): string;
redo(): void {
this.execute();
}
}