ICode9

精准搜索请尝试: 精确搜索
  • 观察者模式2022-06-18 08:06:51

    事件驱动模型,观察者模式 同一个事件,多个监听器 const EventEmitter = require("events"); const myEmitter = new EventEmitter(); // 这里是两个观察者,观察对应的对象,等待对象做出动作 myEmitter.on("newSale", () => { console.log("There was a new sale"); }); myEmitte

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有