doric-cli add createLib
This commit is contained in:
5
doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.h
Normal file
5
doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <DoricCore/Doric.h>
|
||||
|
||||
@interface DoricDemoPlugin : DoricNativePlugin
|
||||
@end
|
7
doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.m
Normal file
7
doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.m
Normal file
@@ -0,0 +1,7 @@
|
||||
#import "DoricDemoPlugin.h"
|
||||
|
||||
@implementation DoricDemoPlugin
|
||||
- (void)call:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
||||
[promise resolve:@"This is from iOS"];
|
||||
}
|
||||
@end
|
5
doric-cli/assets-lib/iOS/Classes/TemplateLibrary.h
Normal file
5
doric-cli/assets-lib/iOS/Classes/TemplateLibrary.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <DoricCore/Doric.h>
|
||||
|
||||
@interface __$RawName__Library : DoricLibrary
|
||||
@end
|
12
doric-cli/assets-lib/iOS/Classes/TemplateLibrary.m
Normal file
12
doric-cli/assets-lib/iOS/Classes/TemplateLibrary.m
Normal file
@@ -0,0 +1,12 @@
|
||||
#import "__$RawName__Library.h"
|
||||
#import "DoricDemoPlugin.h"
|
||||
|
||||
@implementation __$RawName__Library
|
||||
- (void)load:(DoricRegistry *)registry {
|
||||
NSString *path = [[NSBundle mainBundle] bundlePath];
|
||||
NSString *fullPath = [path stringByAppendingPathComponent:@"bundle___$__.js"];
|
||||
NSString *jsContent = [NSString stringWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:nil];
|
||||
[registry registerJSBundle:jsContent withName:@"__$__"];
|
||||
[registry registerNativePlugin:DoricDemoPlugin.class withName:@"demoPlugin"];
|
||||
}
|
||||
@end
|
Reference in New Issue
Block a user