![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
this.name
这个作者很懒,什么都没留下…
展开
-
发布——订阅模式
发布——订阅模式 发布—订阅模式在vue和node.js中广泛使用。 发布—订阅模式的需要 发布者(对象)、订阅者(函数)、订阅函数、触发函数 在vue中有这种代码:this.$on(); this.$emit(); 在node.js中有这种代码: var events = require('events'); var emitter = new events.EventEmitte...原创 2018-08-15 18:02:52 · 422 阅读 · 0 评论 -
工厂函数
工厂函数 1. 首先它是一个函数 2. 用于返回实例对象 如下: function createSong(songid,singer) { return new Song({ songid: songid, singer: singer }) } 异步的工厂函数 返回的是一个异步对象 function factoryFun() {...原创 2018-08-23 10:05:14 · 3083 阅读 · 0 评论