摘要: 定义:保证一个类仅有一个实例,并提供一个访问它的全局访问点。 1. 用传统类的方式实现单例模式 Singleton 提供访问单例对象的统一接口:getInstance() class Singleton { constructor(){ this.instance = null; } static 阅读全文
posted @ 2021-11-20 01:09 箫笛 阅读(99) 评论(0) 推荐(0)