This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/iOS/Pod/Classes/DoricRegistry.m
2019-07-30 11:25:05 +08:00

52 lines
1.2 KiB
Objective-C

//
// DoricRegistry.m
// Doric
//
// Created by pengfei.zhou on 2019/7/27.
//
#import "DoricRegistry.h"
#import "DoricModalPlugin.h"
#import "DoricShaderPlugin.h"
@interface DoricRegistry ()
@property (nonatomic,strong) NSMutableDictionary *bundles;
@property (nonatomic,strong) NSMutableDictionary *plugins;
@end
@implementation DoricRegistry
- (instancetype)init {
if(self = [super init]){
_bundles = [[NSMutableDictionary alloc] init];
_plugins = [[NSMutableDictionary alloc] init];
[self innerRegister];
}
return self;
}
- (void)innerRegister {
[self registerNativePlugin:DoricModalPlugin.class withName:@"modal"];
[self registerNativePlugin:DoricShaderPlugin.class withName:@"shader"];
}
- (void)registerJSBundle:(NSString *)bundle withName:(NSString *)name {
[self.bundles setObject:bundle forKey:name];
}
- (NSString *)acquireJSBundle:(NSString *)name {
return [self.bundles objectForKey:name];
}
- (void)registerNativePlugin:(Class)pluginClass withName:(NSString *)name {
[self.plugins setObject:pluginClass forKey:name];
}
- (Class)acquireNativePlugin:(NSString *)name {
return [self.plugins objectForKey:name];
}
@end