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/DoricContext.m
2019-07-29 15:12:42 +08:00

34 lines
766 B
Objective-C

//
// DoricContext.m
// Doric
//
// Created by pengfei.zhou on 2019/7/25.
//
#import "DoricContext.h"
#import "DoricContextManager.h"
@implementation DoricContext
- (instancetype)initWithScript:(NSString *)script source:(NSString *)source {
if(self = [super init]){
_driver = [DoricDriver instance];
[[DoricContextManager instance] createContext:self script:script source:source];
}
return self;
}
- (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