← Back to design patterns mapbehavioral
📦
Design Pattern
Command
Wrap an action as an object so it can be queued, logged, or undone.
Visual Diagram
Client creates command -> queue/log/execute -> optional undo
When To Use
- ->Undo and redo
- ->Background jobs
- ->Retry queues
- ->Audit logging actions
Used in: BullMQ jobs, task queues, undo stacks
command.js
Live Editor
Loading...
Output
Run code to see output...