refact: use DoricSingleton to hold all static or singleton objects

This commit is contained in:
pengfei.zhou
2021-07-21 17:56:03 +08:00
committed by osborn
parent 7d4d6713c6
commit 61c262bcc6
30 changed files with 320 additions and 221 deletions

View File

@@ -25,8 +25,6 @@
#import "DoricAsyncResult.h"
@interface DoricJSLoaderManager : NSObject
+ (instancetype)instance;
- (void)addJSLoader:(id <DoricLoaderProtocol>)loader;
- (DoricAsyncResult <NSString *> *)request:(NSString *)source;

View File

@@ -30,15 +30,6 @@ @interface DoricJSLoaderManager ()
@end
@implementation DoricJSLoaderManager
+ (instancetype)instance {
static DoricJSLoaderManager *_instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [DoricJSLoaderManager new];
});
return _instance;
}
- (instancetype)init {
if (self = [super init]) {
_loaders = [[NSSet alloc] initWithArray:@[