// The Command pattern is a design pattern lets you encapsulate all
// information needed to perform an action in one object .
class Command {
constructor(private receiver: Receiver) {}
public execute() {
this.receiver.action();
}
}
const receiver = new Receiver();
const command = new Command(receiver);
const invoker = new Invoker();
invoker.setCommand(command);
invoker.execute();