-
Notifications
You must be signed in to change notification settings - Fork 304
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
fix: devtool console log #1328
Conversation
xiaoming0214
commented
Apr 13, 2022
@@ -66,6 +66,7 @@ class UIInspector { | |||
registerModule(InspectPageModule(devtoolsService)); | |||
registerModule(InspectCSSModule(devtoolsService)); | |||
registerModule(InspectNetworkModule(devtoolsService)); | |||
registerModule(InspectorLogModule(devtoolsService)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里命名跟上面统一吧, InspectLogModule
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(
前面空格, ){
之间空格
CI 没过,看起来 crash 了。 |
@xiaoming0214 新添加的 dartMethod 在测试环境也得 mock 一下 |