23 lines
420 B
TypeScript
23 lines
420 B
TypeScript
|
|
import type { Command } from '@/types/history';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Abstract base class for commands
|
||
|
|
*/
|
||
|
|
export abstract class BaseCommand implements Command {
|
||
|
|
public timestamp: number;
|
||
|
|
|
||
|
|
constructor(public name: string) {
|
||
|
|
this.timestamp = Date.now();
|
||
|
|
}
|
||
|
|
|
||
|
|
abstract execute(): void;
|
||
|
|
abstract undo(): void;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Override to implement command merging
|
||
|
|
*/
|
||
|
|
merge(other: Command): boolean {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|