iOS: enable inspect jscontext for dev mode

This commit is contained in:
pengfei.zhou 2023-10-12 12:01:15 +08:00 committed by jingpeng
parent d0fce08ede
commit 2f97ef5d7e

View File

@ -23,6 +23,8 @@
#import <DoricCore/DoricSingleton.h>
#import <DoricCore/DoricNativeDriver.h>
#import <DoricCore/DoricContextManager.h>
#import <DoricCore/DoricJSEngine.h>
#import <DoricCore/DoricJSCoreExecutor.h>
#import "DoricDev.h"
#import "DoricDebugDriver.h"
@ -122,6 +124,13 @@ - (void)openDevMode:(UIViewController *)vc {
navigationController = viewController.navigationController;
}
[navigationController pushViewController:devViewController animated:NO];
if (@available(iOS 16.4, *)) {
DoricJSEngine *jsEngine = DoricSingleton.instance.nativeDriver.jsExecutor;
if ([jsEngine.jsExecutor isKindOfClass:DoricJSCoreExecutor.class]) {
DoricJSCoreExecutor *jsCoreExecutor = jsEngine.jsExecutor;
jsCoreExecutor.jsContext.inspectable = YES;
}
}
}
- (void)closeDevMode {