当前位置:网站首页>(JS) responsibility chain mode
(JS) responsibility chain mode
2022-06-29 11:11:00 【Yu Cainiao, who asked not to be named】
(JS) Responsibility chain pattern
One step operation is divided into multiple roles
Separate roles , Use a chain to string together
class Action {
constructor(name) {
this.name = name;
this.nextAction = null;
}
setNextAction(action) {
this.nextAction = action;
}
handle() {
console.log(`${
this.name} The examination and approval `);
if (this.nextAction != null) {
this.nextAction.handle();
}
}
}
let a1 = new Action("11");
let a2 = new Action("22");
let a3 = new Action("33");
a1.setNextAction(a2);
a2.setNextAction(a3);
a1.handle();
11 The examination and approval
22 The examination and approval
33 The examination and approval
边栏推荐
- BS-GX-018 基于SSM实现在校学生考试系统
- 5. migrate uboot set default environment variables, crop, and partition
- 非凸联合创始人李佐凡:将量化作为自己的终身事业
- USB转RS485串口电路设计「建议收藏」
- Multi thread communication between client and server (primary version)
- Free books! The best-selling book "Introduction and practice of OpenCV image processing" has been completed
- (JS)职责链模式
- Common motor classification and driving principle animation [easy to understand]
- 在线SQL转HTMLTable工具
- Numeric Keypad
猜你喜欢

期未课程设计:基于SSM的产品销售管理系统

非凸联合创始人李佐凡:将量化作为自己的终身事业

第12周实验---基于FPGA的VGA协议实现

Daily question brushing record (VII)
![[digital signal modulation] realize signal modulation and demodulation based on am+fm+dsb+ssb, including Matlab source code](/img/76/bcf0118c8eea2b45b47eda4a68d3fd.png)
[digital signal modulation] realize signal modulation and demodulation based on am+fm+dsb+ssb, including Matlab source code

Spark - one to one correspondence between task and partition and detailed explanation of parameters

Multithreaded high concurrency server: three problems

【每日3题(1)】判断国际象棋棋盘中一个格子的颜色

Cs231n-2022 module1: overview of key points of neural network (2)

He was in '98. I can't play with him
随机推荐
9 easy to use JSON processing tools, greatly improving efficiency!
当技术人成长为 CEO,应该修改哪些“Bug”?
[digital signal modulation] realize signal modulation and demodulation based on am+fm+dsb+ssb, including Matlab source code
5. migrate uboot set default environment variables, crop, and partition
Memory allocation - static storage stack heap and static variable
Spark - one to one correspondence between task and partition and detailed explanation of parameters
Several methods of enterprise competition analysis: SWOT, Porter five forces, pest "suggestions collection"
数据分析方法与思维:漏斗分析
Pipeline aggregations管道聚合- parent-2
【数字信号调制】基于 AM+FM+DSB+SSB实现信号调制解调含Matlab源码
(JS)数组去除重复
Cs231n-2022 module1: overview of key points of neural network (2)
VI退出 退出VIM 适用新手
misc3~7
Does anyone encounter this problem when flinkcdc synchronizes MySQL?
VI exit exit VIM applicable novice
(JS)模仿indexOf方法寻找字符串中某个字符的位置
(JS)数组方法:slice和splice
历史上的今天:马斯克出生;微软推出 Office 365;蔡氏电路的发明者出生
(JS)模仿一个instanceof方法