command-pattern-queue
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

command-pattern-queue

Basic implementation of command-pattern queue

Usage:

// command interface
export interface ICommand {
    execute(): void
    unexecute(): void
}

const commandQueue = new CommandQueue(); // create queue

// execute ICommand-s
await commandQueue.executeCommand(Command1);
await commandQueue.executeCommand(Command2);

await commandQueue.executeCommands([Command3, Command4, Command5, Command6]);

// undo command
await commandQueue.undoCommand() // undo 1 command
await commandQueue.undoCommand(3) // undo 3 command

// redo commands
await commandQueue.redoCommand(); // redo 1 command
await commandQueue.redoCommand(2); // redo 2 command

Package Sidebar

Install

npm i command-pattern-queue

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

21.9 kB

Total Files

27

Last publish

Collaborators

  • maurerkrisztian