Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: devtool console log #1328

Merged
merged 4 commits into from
Apr 14, 2022

Conversation

xiaoming0214
Copy link

image

@@ -66,6 +66,7 @@ class UIInspector {
registerModule(InspectPageModule(devtoolsService));
registerModule(InspectCSSModule(devtoolsService));
registerModule(InspectNetworkModule(devtoolsService));
registerModule(InspectorLogModule(devtoolsService));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里命名跟上面统一吧, InspectLogModule

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -32,6 +32,7 @@ const int DOCUMENT_ID = -2;
typedef LoadHandler = void Function(KrakenController controller);
typedef LoadErrorHandler = void Function(FlutterError error, StackTrace stack);
typedef JSErrorHandler = void Function(String message);
typedef JSLogHandler = void Function(int level,String message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, 后面空格

/// Error = 3,
/// Debug = 4,
/// Info = 5,
String getLevelStr(int level){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

){ 之间空格

InspectorLogModule(IsolateInspectorServer server): super(server);
class InspectLogModule extends UIInspectorModule {
InspectLogModule(ChromeDevToolsService server): super(server){
devtoolsService.controller!.onJSLog = (level,message) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, 后面空格

class InspectorLogModule extends IsolateInspectorModule {
InspectorLogModule(IsolateInspectorServer server): super(server);
class InspectLogModule extends UIInspectorModule {
InspectLogModule(ChromeDevToolsService server): super(server){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: 前面空格, ){ 之间空格

};
}

void handleMessage(int level, String message){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

){ 之间空格

if(controller != null){
JSLogHandler? jsLogHandler = controller.onJSLog;
if (jsLogHandler != null) {
print('_onJSLog $level $msg');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这行不需要吧

void _onJSLog(int contextId, int level, Pointer<Utf8> charStr) {
String msg = charStr.toDartString();
KrakenController? controller = KrakenController.getControllerOfJSContextId(contextId);
if(controller != null){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

( 前面空格, ){ 之间空格

@answershuto
Copy link
Member

CI 没过,看起来 crash 了。

@andycall
Copy link
Member

@xiaoming0214 新添加的 dartMethod 在测试环境也得 mock 一下

@answershuto answershuto merged commit bb293bf into openkraken:main Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants