feat:fix Register DevMonitor

This commit is contained in:
pengfeizhou 2021-02-07 15:58:11 +08:00 committed by osborn
parent cf4d0498b9
commit 8f0486329e
2 changed files with 3 additions and 25 deletions

View File

@ -14,6 +14,7 @@ import pub.doric.Doric;
import pub.doric.DoricContext; import pub.doric.DoricContext;
import pub.doric.DoricContextManager; import pub.doric.DoricContextManager;
import pub.doric.DoricLibrary; import pub.doric.DoricLibrary;
import pub.doric.DoricNativeDriver;
import pub.doric.DoricRegistry; import pub.doric.DoricRegistry;
import pub.doric.devkit.event.ConnectExceptionEvent; import pub.doric.devkit.event.ConnectExceptionEvent;
import pub.doric.devkit.event.EOFExceptionEvent; import pub.doric.devkit.event.EOFExceptionEvent;
@ -34,16 +35,7 @@ public class DevKit implements IDevKit {
} }
private DevKit() { private DevKit() {
Doric.registerLibrary(new DoricLibrary() { DoricNativeDriver.getInstance().getRegistry().registerMonitor(new DoricDevMonitor());
@Override
public void load(DoricRegistry registry) {
registry.registerMonitor(new DoricDevMonitor());
}
});
for (DoricContext context : DoricContextManager.aliveContexts()) {
context.getDriver().getRegistry().registerMonitor(new DoricDevMonitor());
break;
}
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
} }

View File

@ -30,15 +30,6 @@
#import "DoricDevViewController.h" #import "DoricDevViewController.h"
#import "DoricDevMonitor.h" #import "DoricDevMonitor.h"
@interface DoricDevLibrary : DoricLibrary
@end
@implementation DoricDevLibrary
- (void)load:(DoricRegistry *)registry {
}
@end
@interface DoricDev () @interface DoricDev ()
@property(nonatomic, strong) DoricWSClient *wsclient; @property(nonatomic, strong) DoricWSClient *wsclient;
@property(nonatomic, strong) DoricContext *context; @property(nonatomic, strong) DoricContext *context;
@ -56,12 +47,7 @@ - (instancetype)init {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onEnterDebugEvent) name:@"EnterDebugEvent" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onEnterDebugEvent) name:@"EnterDebugEvent" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onStopDebugEvent) name:@"StopDebugEvent" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onStopDebugEvent) name:@"StopDebugEvent" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onDebuggerReadyEvent) name:@"DebuggerReadyEvent" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onDebuggerReadyEvent) name:@"DebuggerReadyEvent" object:nil];
[Doric registerLibrary:[DoricDevLibrary new]]; [DoricNativeDriver.instance.registry registerMonitor:[DoricDevMonitor new]];
NSValue *value = DoricContextManager.instance.aliveContexts.firstObject;
if (value) {
DoricContext *context = value.nonretainedObjectValue;
[context.driver.registry registerMonitor:[DoricDevMonitor new]];
}
} }
return self; return self;
} }