iOS: move bundle to DoricSingleton
This commit is contained in:
parent
598bde8442
commit
0ffb14ec72
@ -58,7 +58,6 @@
|
||||
|
||||
@interface DoricRegistry ()
|
||||
|
||||
@property(nonatomic, strong) NSMutableDictionary *bundles;
|
||||
@property(nonatomic, strong) NSMutableDictionary *plugins;
|
||||
@property(nonatomic, strong) NSMutableDictionary *nodes;
|
||||
@property(nonatomic, strong) NSMutableSet <id <DoricMonitorProtocol>> *monitors;
|
||||
@ -80,7 +79,6 @@ + (void)register:(DoricLibrary *)library {
|
||||
- (instancetype)initWithJSEngine:(DoricJSEngine *)jsEngine {
|
||||
if (self = [super init]) {
|
||||
_jsEngine = jsEngine;
|
||||
_bundles = [NSMutableDictionary new];
|
||||
_plugins = [NSMutableDictionary new];
|
||||
_nodes = [NSMutableDictionary new];
|
||||
_monitors = [NSMutableSet new];
|
||||
@ -130,11 +128,11 @@ - (void)innerRegister {
|
||||
}
|
||||
|
||||
- (void)registerJSBundle:(NSString *)bundle withName:(NSString *)name {
|
||||
self.bundles[name] = bundle;
|
||||
DoricSingleton.instance.bundles[name] = bundle;
|
||||
}
|
||||
|
||||
- (NSString *)acquireJSBundle:(NSString *)name {
|
||||
return self.bundles[name];
|
||||
return DoricSingleton.instance.bundles[name];
|
||||
}
|
||||
|
||||
- (void)registerNativePlugin:(Class)pluginClass withName:(NSString *)name {
|
||||
|
@ -26,6 +26,7 @@
|
||||
@class DoricContextManager;
|
||||
|
||||
@interface DoricSingleton : NSObject
|
||||
@property(nonatomic, strong) NSMutableDictionary *bundles;
|
||||
@property(nonatomic, strong) NSMutableSet <DoricLibrary *> *libraries;
|
||||
@property(nonatomic, strong) NSHashTable<DoricRegistry *> *registries;
|
||||
@property(nonatomic, strong) NSMutableDictionary *envDic;
|
||||
|
@ -37,6 +37,7 @@ - (instancetype)init {
|
||||
_storageCaches = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsCopyIn
|
||||
valueOptions:NSPointerFunctionsWeakMemory
|
||||
capacity:0];
|
||||
_bundles = [NSMutableDictionary new];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
Reference in New Issue
Block a user