First, the concept of command mode
Command mode is defined as the use of parameterized processing and routing of method calls, which can be executed at any time when the method call has been processed. That is, the pattern is designed to encapsulate the invocation, request, and operation of a function into a single object, and then perform some column processing on that object. He can also be used to eliminate the coupling between the object that invokes the operation and the object that implements the operation. This provides a great deal of flexibility for the replacement of a variety of specific classes.
Second, the role of command mode and matters needing attention
Mode function:
1, the function of encapsulation, request, call combined into one
2. Call specific function decoupling command object and receiving object
3, improve the flexibility of program modularity
Precautions:
1, do not need an excuse to be consistent, direct call function can, lest cause waste
Third, the command mode code and the actual combat summary
The above is a small set to introduce the JavaScript design model of the Classic command mode, I hope to help you!