Constructor.
You should not need to define a constructor,
instead, override the initializeMacroCommand
method.
If your subclass does define a constructor, be
sure to call super().
ProtectedmultitonThe Multiton Key for this app
Protected StaticMULTITON_Message Constants
ProtectedaddExecute this MacroCommand's SubCommands.
The SubCommands will be called in First In/First Out (FIFO)
order.
The notification containing the data or command details to be processed.
Initialize the MacroCommand.
In your subclass, override this method to
initialize the MacroCommand's SubCommand
list with Command class references like
this:
// Initialize MyMacroCommand
initializeMacroCommand() {
this.addSubCommand(() => new app.FirstCommand());
this.addSubCommand(() => new app.SecondCommand());
this.addSubCommand(() => new app.ThirdCommand());
}
Note that SubCommands may be any Command implementor,
MacroCommands or SimpleCommands are both acceptable.
Initialize this Notifier instance.
This is how a Notifier gets its multitonKey. Calls to sendNotification or to access the facade will fail until after this method has been called.
Mediators, Commands or Proxies may override this method in order to send notifications or access the Multiton Facade instance as soon as possible. They CANNOT access the facade in their constructors, since this method will not yet have been called.
the multitonKey for this Notifier to use
Create and send an Notification.
Keeps us from having to construct new Notification instances in our implementation code.
The name of the notification to be sent.
Optionalbody: anyOptional data to be included with the notification.
Optionaltype: stringOptional type of the notification.
A base
Commandimplementation that executes otherCommands.A
MacroCommandmaintains a list ofCommandClass references calledSubCommands.When
executeis called, theMacroCommandinstantiates and callsexecuteon each of itsSubCommandsturn. EachSubCommandwill be passed a reference to the originalNotificationthat was passed to theMacroCommand'sexecutemethod.Unlike
SimpleCommand, your subclass should not overrideexecute, but instead, should override theinitializeMacroCommandmethod, callingaddSubCommandonce for eachSubCommandto be executed.See
MacroCommand