JSPM

command-pattern-queue

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q22174F
  • License ISC

Package Exports

  • command-pattern-queue

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (command-pattern-queue) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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