feat:add Environment
This commit is contained in:
parent
24fb291ba8
commit
7247d99db6
@ -55,12 +55,20 @@ - (instancetype)init {
|
||||
|
||||
- (void)initJSExecutor {
|
||||
__weak typeof(self) _self = self;
|
||||
|
||||
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
||||
[self.jsExecutor injectGlobalJSObject:INJECT_ENVIRONMENT obj:@{
|
||||
@"platform": @"iOS",
|
||||
@"platformVersion": [[UIDevice currentDevice] systemVersion],
|
||||
@"appName": infoDictionary[@"CFBundleName"],
|
||||
@"appVersion": infoDictionary[@"CFBundleShortVersionString"],
|
||||
@"screenWidth": @([[UIScreen mainScreen] bounds].size.width),
|
||||
@"screenHeight": @([[UIScreen mainScreen] bounds].size.height),
|
||||
}];
|
||||
[self.jsExecutor injectGlobalJSObject:INJECT_LOG obj:^(NSString *type, NSString *message) {
|
||||
DoricLog(@"JS:%@", message);
|
||||
}];
|
||||
[self.jsExecutor injectGlobalJSObject:INJECT_EMPTY obj:^() {
|
||||
|
||||
|
||||
}];
|
||||
[self.jsExecutor injectGlobalJSObject:INJECT_REQUIRE obj:^(NSString *name) {
|
||||
__strong typeof(_self) self = _self;
|
||||
|
@ -26,7 +26,7 @@ extern NSString *const DORIC_BUNDLE_SANDBOX;
|
||||
extern NSString *const DORIC_BUNDLE_LIB;
|
||||
extern NSString *const DORIC_MODULE_LIB;
|
||||
|
||||
|
||||
extern NSString *const INJECT_ENVIRONMENT;
|
||||
extern NSString *const INJECT_LOG;
|
||||
extern NSString *const INJECT_REQUIRE;
|
||||
extern NSString *const INJECT_TIMER_SET;
|
||||
|
@ -26,6 +26,7 @@
|
||||
NSString *const DORIC_BUNDLE_LIB = @"doric-lib";
|
||||
NSString *const DORIC_MODULE_LIB = @"doric";
|
||||
|
||||
NSString *const INJECT_ENVIRONMENT = @"Environment";
|
||||
|
||||
NSString *const INJECT_LOG = @"nativeLog";
|
||||
NSString *const INJECT_REQUIRE = @"nativeRequire";
|
||||
|
Reference in New Issue
Block a user