单实例模式

1 var getSingleInstance = function(fn) {
2     var _instance = null;
3     return function() {
4         return _instance || (_instance = fn.apply(this, arguments));
5     }
6 };

 

posted @ 2020-06-11 11:40  xlsdg  阅读(48)  评论(0)    收藏  举报