15. responsibility chain mode of JavaScript design mode ---- chain of responsibility
Concept of responsibility chain model
The responsibility chain mode is generally defined as follows: Multiple objects have the opportunity to process requests, so as to avoid coupling between request senders and receivers, that is, connect these objects into one (processing) chain and pass the request along the chain until the end of the chain has an object to process it.
The most typical application of the responsibility chain mode is the Web. xml filter in the javaee specification. The filters process the mapping conditions in sequence according to the configuration order.
The filtered Web Request/response can implement many "Responsibilities" such as encoding conversion, transaction encapsulation, and page cache ".
Applicability of the responsibility chain model:
1. There are multiple objects that can process a request, and the object that processes the request is automatically determined at the runtime. 2. If you want to submit a request to one of multiple objects without specifying the receiver explicitly. 3. The object set that can process a request must be dynamically specified.
The sample code for this design pattern is not provided here...
For more information about this design model, if you need it, remember "Baidu" Oh O (Baidu _ Baidu) O ~