success run js on iOS

This commit is contained in:
pengfei.zhou 2019-07-29 13:48:27 +08:00
parent 0b285fe470
commit 2a53b24aff
21 changed files with 282 additions and 103 deletions

View File

@ -10,7 +10,7 @@
#import "UIView+Doric.h" #import "UIView+Doric.h"
#import "DoricJSCoreExecutor.h" #import "DoricJSCoreExecutor.h"
#import "DoricUtil.h" #import "DoricUtil.h"
#import "DoricJSEngine.h" #import "DoricContext.h"
@interface ViewController () @interface ViewController ()
@ -26,39 +26,17 @@ - (void)viewDidLoad {
label.centerX = self.view.width/2; label.centerX = self.view.width/2;
label.centerY = self.view.height/2; label.centerY = self.view.height/2;
[self.view addSubview:label]; [self.view addSubview:label];
// DoricJSCoreExecutor *jse = [[DoricJSCoreExecutor alloc] init];
// @try{
// NSString *ret = [jse loadJSScript:@"typef Reflect" source:@"test"];
// NSLog(@"js result %@", ret);
// }@catch(NSException *e){
// NSLog(@"catch Exception: %@,reason is %@",e.name,e.reason);
// }
// DoricLog(@"%@",@"testxxxxx");
// DoricLog(@"test2rwr");
DoricJSEngine *jsengine = [[DoricJSEngine alloc] init];
[self test:@"method",@"1",@"2",nil];
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(test:)];
[label addGestureRecognizer:recognizer];
label.userInteractionEnabled = YES;
}
- (void)test:(UIView *)view {
NSLog(@"test");
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"demo" ofType:@"js"]; NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"demo" ofType:@"js"];
NSString *jsContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; NSString *jsContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
NSLog(@"%@",jsContent); DoricContext *context = [[DoricContext alloc] initWithScript:jsContent source:@"demo"];
[context callEntity:@"log",nil];
} }
-(void)test:(NSString *)method,... {
va_list args;
va_start(args, method);
[self test2:method args:args];
va_end(args);
}
-(void)test2:(NSString *)method args:(va_list)args {
NSMutableArray *array = [[NSMutableArray alloc] init];
id arg = va_arg(args, id);
while(arg != nil){
[array addObject:arg];
arg = va_arg(args, id);
}
for(id obj in array){
DoricLog(@"test:%@",obj);
}
}
@end @end

View File

@ -26,6 +26,12 @@
B11353DC82971A59A3B9A964C10C27E8 /* DoricConstant.m in Sources */ = {isa = PBXBuildFile; fileRef = 90BA27E3131D8AD1F16CAAB652BC8A6F /* DoricConstant.m */; }; B11353DC82971A59A3B9A964C10C27E8 /* DoricConstant.m in Sources */ = {isa = PBXBuildFile; fileRef = 90BA27E3131D8AD1F16CAAB652BC8A6F /* DoricConstant.m */; };
C7ED691918B3C06F6BC8F1AB6053EF9B /* DoricRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3A731BCB183E444C5710694419A75 /* DoricRegistry.m */; }; C7ED691918B3C06F6BC8F1AB6053EF9B /* DoricRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3A731BCB183E444C5710694419A75 /* DoricRegistry.m */; };
DFF3C5963916D9D1639FC2AD82CE565D /* DoricDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 62660F1C7619EBD08D60183EBCA25264 /* DoricDriver.m */; }; DFF3C5963916D9D1639FC2AD82CE565D /* DoricDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 62660F1C7619EBD08D60183EBCA25264 /* DoricDriver.m */; };
E2D4F74022EE989100F3505C /* DoricNativePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = E2D4F73E22EE989100F3505C /* DoricNativePlugin.h */; };
E2D4F74122EE989100F3505C /* DoricNativePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4F73F22EE989100F3505C /* DoricNativePlugin.m */; };
E2D4F74422EE98BE00F3505C /* DoricComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = E2D4F74222EE98BE00F3505C /* DoricComponent.h */; };
E2D4F74522EE98BE00F3505C /* DoricComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4F74322EE98BE00F3505C /* DoricComponent.m */; };
E2D4F74822EE993700F3505C /* DoricContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E2D4F74622EE993700F3505C /* DoricContextManager.h */; };
E2D4F74922EE993700F3505C /* DoricContextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4F74722EE993700F3505C /* DoricContextManager.m */; };
EA731CD398F00F7D323997F93BFD41AF /* DoricRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A0EF08B92B94EA54769E3E1FF457F1 /* DoricRegistry.h */; settings = {ATTRIBUTES = (Project, ); }; }; EA731CD398F00F7D323997F93BFD41AF /* DoricRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A0EF08B92B94EA54769E3E1FF457F1 /* DoricRegistry.h */; settings = {ATTRIBUTES = (Project, ); }; };
F4E16288FC129140C02208B679E8B542 /* DoricJSEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = C15B34E4FFB9B99AB3F6D59A598F790A /* DoricJSEngine.h */; settings = {ATTRIBUTES = (Project, ); }; }; F4E16288FC129140C02208B679E8B542 /* DoricJSEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = C15B34E4FFB9B99AB3F6D59A598F790A /* DoricJSEngine.h */; settings = {ATTRIBUTES = (Project, ); }; };
FB12A9CBA1D8C27712FA842DF1AFB1F5 /* DoricJSEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 88511A56B36DE729D1795F4F8DD34260 /* DoricJSEngine.m */; }; FB12A9CBA1D8C27712FA842DF1AFB1F5 /* DoricJSEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 88511A56B36DE729D1795F4F8DD34260 /* DoricJSEngine.m */; };
@ -101,6 +107,12 @@
CB6504BD07E3990E6F058E4073421ADA /* libDoric.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDoric.a; sourceTree = BUILT_PRODUCTS_DIR; }; CB6504BD07E3990E6F058E4073421ADA /* libDoric.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDoric.a; sourceTree = BUILT_PRODUCTS_DIR; };
DA28ABFF81EEE93AEFD6DEE2A3C006DD /* DoricJSCoreExecutor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = DoricJSCoreExecutor.m; path = Pod/Classes/DoricJSCoreExecutor.m; sourceTree = "<group>"; }; DA28ABFF81EEE93AEFD6DEE2A3C006DD /* DoricJSCoreExecutor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = DoricJSCoreExecutor.m; path = Pod/Classes/DoricJSCoreExecutor.m; sourceTree = "<group>"; };
DFFAD17E7567EE856A59F246D50A9B0B /* Pods-Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Example-acknowledgements.plist"; sourceTree = "<group>"; }; DFFAD17E7567EE856A59F246D50A9B0B /* Pods-Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Example-acknowledgements.plist"; sourceTree = "<group>"; };
E2D4F73E22EE989100F3505C /* DoricNativePlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DoricNativePlugin.h; path = Pod/Classes/DoricNativePlugin.h; sourceTree = "<group>"; };
E2D4F73F22EE989100F3505C /* DoricNativePlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = DoricNativePlugin.m; path = Pod/Classes/DoricNativePlugin.m; sourceTree = "<group>"; };
E2D4F74222EE98BE00F3505C /* DoricComponent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DoricComponent.h; path = Pod/Classes/DoricComponent.h; sourceTree = "<group>"; };
E2D4F74322EE98BE00F3505C /* DoricComponent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = DoricComponent.m; path = Pod/Classes/DoricComponent.m; sourceTree = "<group>"; };
E2D4F74622EE993700F3505C /* DoricContextManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DoricContextManager.h; path = Pod/Classes/DoricContextManager.h; sourceTree = "<group>"; };
E2D4F74722EE993700F3505C /* DoricContextManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = DoricContextManager.m; path = Pod/Classes/DoricContextManager.m; sourceTree = "<group>"; };
E340F908A05867E06E975FDCDD32315C /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Example.debug.xcconfig"; sourceTree = "<group>"; }; E340F908A05867E06E975FDCDD32315C /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Example.debug.xcconfig"; sourceTree = "<group>"; };
ED84F8134A4F3E235AB8C90C513CCE8D /* DoricAsyncResult.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = DoricAsyncResult.h; path = Pod/Classes/DoricAsyncResult.h; sourceTree = "<group>"; }; ED84F8134A4F3E235AB8C90C513CCE8D /* DoricAsyncResult.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = DoricAsyncResult.h; path = Pod/Classes/DoricAsyncResult.h; sourceTree = "<group>"; };
FE99AB24E829DD35491764E2DED6ED75 /* Pods-ExampleUITests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-ExampleUITests-dummy.m"; sourceTree = "<group>"; }; FE99AB24E829DD35491764E2DED6ED75 /* Pods-ExampleUITests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-ExampleUITests-dummy.m"; sourceTree = "<group>"; };
@ -194,6 +206,12 @@
6BCC7D6EBF85DA7FAFF5BFC78EA00CBE /* Pod */, 6BCC7D6EBF85DA7FAFF5BFC78EA00CBE /* Pod */,
768CE4306033647F2B1F5CD75DAFB96C /* Resources */, 768CE4306033647F2B1F5CD75DAFB96C /* Resources */,
2E38CAB4D62BB195E976B365C3873983 /* Support Files */, 2E38CAB4D62BB195E976B365C3873983 /* Support Files */,
E2D4F73E22EE989100F3505C /* DoricNativePlugin.h */,
E2D4F73F22EE989100F3505C /* DoricNativePlugin.m */,
E2D4F74222EE98BE00F3505C /* DoricComponent.h */,
E2D4F74322EE98BE00F3505C /* DoricComponent.m */,
E2D4F74622EE993700F3505C /* DoricContextManager.h */,
E2D4F74722EE993700F3505C /* DoricContextManager.m */,
); );
name = Doric; name = Doric;
path = ../..; path = ../..;
@ -306,7 +324,9 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
B077ABFB167A93C6D567B40768552671 /* DoricAsyncResult.h in Headers */, B077ABFB167A93C6D567B40768552671 /* DoricAsyncResult.h in Headers */,
E2D4F74022EE989100F3505C /* DoricNativePlugin.h in Headers */,
239169CBB6F7EB156C14D028FDF45116 /* DoricConstant.h in Headers */, 239169CBB6F7EB156C14D028FDF45116 /* DoricConstant.h in Headers */,
E2D4F74822EE993700F3505C /* DoricContextManager.h in Headers */,
88B52F11DA33AC294B0218D33528AE40 /* DoricContext.h in Headers */, 88B52F11DA33AC294B0218D33528AE40 /* DoricContext.h in Headers */,
588D3C18C53399B7326E2C3C51EC9ED6 /* DoricDriver.h in Headers */, 588D3C18C53399B7326E2C3C51EC9ED6 /* DoricDriver.h in Headers */,
091F9B16A4F4143E4B2455D01DB9E702 /* DoricJSCoreExecutor.h in Headers */, 091F9B16A4F4143E4B2455D01DB9E702 /* DoricJSCoreExecutor.h in Headers */,
@ -314,6 +334,7 @@
0D09DCE69AE127709FC4DFDF99C20A43 /* DoricJSExecutorProtocal.h in Headers */, 0D09DCE69AE127709FC4DFDF99C20A43 /* DoricJSExecutorProtocal.h in Headers */,
EA731CD398F00F7D323997F93BFD41AF /* DoricRegistry.h in Headers */, EA731CD398F00F7D323997F93BFD41AF /* DoricRegistry.h in Headers */,
FCE039F2439D368237828ADB77E8B6A2 /* DoricUtil.h in Headers */, FCE039F2439D368237828ADB77E8B6A2 /* DoricUtil.h in Headers */,
E2D4F74422EE98BE00F3505C /* DoricComponent.h in Headers */,
44E1706571817930D669A7B0D370E182 /* UIView+Doric.h in Headers */, 44E1706571817930D669A7B0D370E182 /* UIView+Doric.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@ -474,13 +495,16 @@
9D89A3FF79363D73AA1A2AA18BEF1892 /* Doric-dummy.m in Sources */, 9D89A3FF79363D73AA1A2AA18BEF1892 /* Doric-dummy.m in Sources */,
230F21EB13596FBD921AAC0F03564DF6 /* DoricAsyncResult.m in Sources */, 230F21EB13596FBD921AAC0F03564DF6 /* DoricAsyncResult.m in Sources */,
B11353DC82971A59A3B9A964C10C27E8 /* DoricConstant.m in Sources */, B11353DC82971A59A3B9A964C10C27E8 /* DoricConstant.m in Sources */,
E2D4F74122EE989100F3505C /* DoricNativePlugin.m in Sources */,
379D57B4BA7F04B71421ADD9E1A4D17F /* DoricContext.m in Sources */, 379D57B4BA7F04B71421ADD9E1A4D17F /* DoricContext.m in Sources */,
DFF3C5963916D9D1639FC2AD82CE565D /* DoricDriver.m in Sources */, DFF3C5963916D9D1639FC2AD82CE565D /* DoricDriver.m in Sources */,
2AD7CC40AC77844B33FF143A3607DC04 /* DoricJSCoreExecutor.m in Sources */, 2AD7CC40AC77844B33FF143A3607DC04 /* DoricJSCoreExecutor.m in Sources */,
E2D4F74922EE993700F3505C /* DoricContextManager.m in Sources */,
FB12A9CBA1D8C27712FA842DF1AFB1F5 /* DoricJSEngine.m in Sources */, FB12A9CBA1D8C27712FA842DF1AFB1F5 /* DoricJSEngine.m in Sources */,
C7ED691918B3C06F6BC8F1AB6053EF9B /* DoricRegistry.m in Sources */, C7ED691918B3C06F6BC8F1AB6053EF9B /* DoricRegistry.m in Sources */,
92CB625B157F7D9ED55DFD3718726F18 /* DoricUtil.m in Sources */, 92CB625B157F7D9ED55DFD3718726F18 /* DoricUtil.m in Sources */,
54D16DC1BDD43F45E8DFFE38CC5323FC /* UIView+Doric.m in Sources */, 54D16DC1BDD43F45E8DFFE38CC5323FC /* UIView+Doric.m in Sources */,
E2D4F74522EE98BE00F3505C /* DoricComponent.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -0,0 +1,15 @@
//
// DoricComponent.h
// Doric
//
// Created by pengfei.zhou on 2019/7/29.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DoricComponent : NSObject
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,12 @@
//
// DoricComponent.m
// Doric
//
// Created by pengfei.zhou on 2019/7/29.
//
#import "DoricComponent.h"
@implementation DoricComponent
@end

View File

@ -6,12 +6,18 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "DoricDriver.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface DoricContext : NSObject @interface DoricContext : NSObject
@property (nonatomic,strong) NSString *contextId; @property (nonatomic,strong) NSString *contextId;
@property (nonatomic,strong) DoricDriver *driver;
- (instancetype)initWithScript:(NSString *)script source:(NSString *)source;
- (DoricAsyncResult *)callEntity:(NSString *)method, ...;
@end @end

View File

@ -6,7 +6,31 @@
// //
#import "DoricContext.h" #import "DoricContext.h"
#import "DoricContextManager.h"
@implementation DoricContext @implementation DoricContext
- (instancetype)init {
if(self = [super init]){
_driver = [DoricDriver instance];
}
return self;
}
- (instancetype)initWithScript:(NSString *)script source:(NSString *)source {
return [[DoricContextManager instance] createContext:script source:source];
}
- (void)dealloc {
[[DoricContextManager instance] destroyContext:self];
}
- (DoricAsyncResult *)callEntity:(NSString *)method, ... {
va_list args;
va_start(args, method);
DoricAsyncResult *ret = [self.driver invokeContextEntity:self.contextId method:method arguments:args];
va_end(args);
return ret;
}
@end @end

View File

@ -0,0 +1,21 @@
//
// DoricContextManager.h
// Doric
//
// Created by pengfei.zhou on 2019/7/29.
//
#import <Foundation/Foundation.h>
#import "DoricContext.h"
NS_ASSUME_NONNULL_BEGIN
@interface DoricContextManager : NSObject
+ (instancetype) instance;
- (DoricContext *)createContext:(NSString *)script source:(NSString *)source;
- (void) destroyContext:(DoricContext *)context;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,57 @@
//
// DoricContextManager.m
// Doric
//
// Created by pengfei.zhou on 2019/7/29.
//
#import "DoricContextManager.h"
#import "DoricContext.h"
@interface DoricContextManager()
@property (nonatomic) NSInteger counter;
@property (nonatomic,strong) NSMutableDictionary *doricContextMap;
@property (nonatomic,strong) dispatch_queue_t mapQueue;
@end
@implementation DoricContextManager
- (instancetype)init {
if(self = [super init]){
_doricContextMap = [[NSMutableDictionary alloc] init];
_counter = 0;
_mapQueue = dispatch_queue_create("doric.contextmap", DISPATCH_QUEUE_SERIAL);
}
return self;
}
+ (instancetype)instance{
static DoricContextManager *_instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[DoricContextManager alloc] init];
});
return _instance;
}
- (DoricContext *)createContext:(NSString *)script source:(NSString *)source {
DoricContext *doricContext = [[DoricContext alloc] init];
doricContext.contextId = [NSString stringWithFormat:@"%ld", (long)self.counter++];
[doricContext.driver createContext:doricContext.contextId script:script source:source];
dispatch_sync(self.mapQueue, ^(){
[self.doricContextMap setValue:doricContext forKey:doricContext.contextId];
});
return doricContext;
}
- (void) destroyContext:(DoricContext *)context {
NSString *contextId = context.contextId;
[[context.driver destroyContext:contextId] setFinishCallback:^(){
dispatch_sync(self.mapQueue, ^(){
[self.doricContextMap removeObjectForKey:contextId];
});
}];
}
@end

View File

@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
- (DoricAsyncResult *)invokeDoricMethod:(NSString *)method, ...; - (DoricAsyncResult *)invokeDoricMethod:(NSString *)method, ...;
- (DoricAsyncResult *)invokeContextEntity:(NSString *)contextId method:(NSString *)method, ...; - (DoricAsyncResult *)invokeContextEntity:(NSString *)contextId method:(NSString *)method, ...;
- (DoricAsyncResult *)invokeContextEntity:(NSString *)contextId method:(NSString *)method arguments:(va_list) args;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -17,6 +17,13 @@ @implementation DoricDriver
@dynamic registry; @dynamic registry;
- (instancetype)init {
if(self = [super init]){
_jsExecutor = [[DoricJSEngine alloc] init];
}
return self;
}
- (DoricRegistry *)registry { - (DoricRegistry *)registry {
return self.jsExecutor.registry; return self.jsExecutor.registry;
} }
@ -55,19 +62,23 @@ + (instancetype)instance{
} }
- (DoricAsyncResult<JSValue *> *)invokeContextEntity:(NSString *)contextId method:(NSString *)method,... { - (DoricAsyncResult<JSValue *> *)invokeContextEntity:(NSString *)contextId method:(NSString *)method,... {
DoricAsyncResult *ret = [[DoricAsyncResult alloc] init];
NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:DORIC_CONTEXT_INVOKE];
[array addObject:contextId];
[array addObject:method];
va_list args; va_list args;
va_start(args, method); va_start(args, method);
DoricAsyncResult *ret = [self invokeContextEntity:contextId method:method arguments:args];
va_end(args);
return ret;
}
- (DoricAsyncResult *)invokeContextEntity:(NSString *)contextId method:(NSString *)method arguments:(va_list)args {
DoricAsyncResult *ret = [[DoricAsyncResult alloc] init];
NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:contextId];
[array addObject:method];
id arg = va_arg(args, id); id arg = va_arg(args, id);
while(arg != nil){ while(arg != nil){
[array addObject:arg]; [array addObject:arg];
arg = va_arg(args, JSValue *); arg = va_arg(args, JSValue *);
} }
va_end(args);
__weak typeof(self) _self = self; __weak typeof(self) _self = self;
dispatch_async(self.jsExecutor.jsQueue, ^(){ dispatch_async(self.jsExecutor.jsQueue, ^(){
__strong typeof(_self) self = _self; __strong typeof(_self) self = _self;

View File

@ -25,6 +25,7 @@ -(instancetype)init {
self.timers = [[NSMutableDictionary alloc] init]; self.timers = [[NSMutableDictionary alloc] init];
self.jsExecutor = [[DoricJSCoreExecutor alloc] init]; self.jsExecutor = [[DoricJSCoreExecutor alloc] init];
self.registry = [[DoricRegistry alloc] init]; self.registry = [[DoricRegistry alloc] init];
[self initJSExecutor];
[self initDoricEnvironment]; [self initDoricEnvironment];
}); });
} }

View File

@ -0,0 +1,16 @@
//
// DoricNativePlugin.h
// Doric
//
// Created by pengfei.zhou on 2019/7/29.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DoricNativePlugin : NSObject
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,12 @@
//
// DoricNativePlugin.m
// Doric
//
// Created by pengfei.zhou on 2019/7/29.
//
#import "DoricNativePlugin.h"
@implementation DoricNativePlugin
@end

View File

@ -48,6 +48,7 @@ class CounterVM extends ViewModel<CountModel, CounterView> {
} }
} }
@Entry
class MyPage extends VMPanel<CountModel, CounterView>{ class MyPage extends VMPanel<CountModel, CounterView>{
getVMClass() { getVMClass() {
@ -369,7 +370,6 @@ class SnakeVM extends ViewModel<SnakeModel, SnakeView>{
} }
} }
@Entry
class SnakePanel extends VMPanel<SnakeModel, SnakeView>{ class SnakePanel extends VMPanel<SnakeModel, SnakeView>{
getVMClass() { getVMClass() {