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