Refact:delete and optimize code
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricDev : NSObject
|
||||
@property(nonatomic, strong, nullable) DoricWSClient *wsClient;
|
||||
|
||||
+ (instancetype)instance;
|
||||
|
||||
@@ -41,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)stopDebugging:(BOOL)resume;
|
||||
|
||||
- (void)reload:(NSString *)source script:(NSString *)script;
|
||||
|
||||
- (void)sendDevCommand:(NSString *)command payload:(NSDictionary *)payload;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -63,6 +63,7 @@ - (void)stopDebug:(BOOL)resume {
|
||||
|
||||
|
||||
@interface DoricDev ()
|
||||
@property(nonatomic, strong, nullable) DoricWSClient *wsClient;
|
||||
@property(nonatomic, strong) DoricContextDebuggable *debuggable;
|
||||
@end
|
||||
|
||||
@@ -177,4 +178,8 @@ - (void)stopDebugging:(BOOL)resume {
|
||||
[self.debuggable stopDebug:resume];
|
||||
self.debuggable = nil;
|
||||
}
|
||||
|
||||
- (void)sendDevCommand:(NSString *)command payload:(NSDictionary *)payload {
|
||||
[self.wsClient sendToServer:command payload:payload];
|
||||
}
|
||||
@end
|
||||
|
@@ -30,11 +30,11 @@ - (void)onException:(NSException *)exception inContext:(DoricContext *)context {
|
||||
if (!DoricDev.instance.isInDevMode) {
|
||||
return;
|
||||
}
|
||||
[DoricDev.instance.wsClient sendToServer:@"EXCEPTION"
|
||||
payload:@{
|
||||
@"source": [context.source stringByReplacingOccurrencesOfString:@".js" withString:@".ts"],
|
||||
@"exception": exception.reason
|
||||
}];
|
||||
[DoricDev.instance sendDevCommand:@"EXCEPTION"
|
||||
payload:@{
|
||||
@"source": [context.source stringByReplacingOccurrencesOfString:@".js" withString:@".ts"],
|
||||
@"exception": exception.reason
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)onLog:(DoricLogType)type message:(NSString *)message {
|
||||
@@ -48,10 +48,10 @@ - (void)onLog:(DoricLogType)type message:(NSString *)message {
|
||||
typeString = @"ERROR";
|
||||
}
|
||||
|
||||
[DoricDev.instance.wsClient sendToServer:@"LOG"
|
||||
payload:@{
|
||||
@"type": typeString,
|
||||
@"message": message
|
||||
}];
|
||||
[DoricDev.instance sendDevCommand:@"LOG"
|
||||
payload:@{
|
||||
@"type": typeString,
|
||||
@"message": message
|
||||
}];
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user