feat:reload match context adjust

This commit is contained in:
pengfeizhou 2021-02-25 11:31:55 +08:00 committed by osborn
parent 39fbd296de
commit d834f03835
2 changed files with 14 additions and 2 deletions

View File

@ -206,8 +206,10 @@ public class DoricDev {
}
public DoricContext matchContext(String source) {
source = source.replace(".js", "").replace(".ts", "");
for (DoricContext context : DoricContextManager.aliveContexts()) {
if (source.contains(context.getSource()) || context.getSource().equals("__dev__")) {
String doricSource = context.getSource().replace(".js", "").replace(".ts", "");
if (source.equals(doricSource) || doricSource.equals("__dev__")) {
return context;
}
}

View File

@ -154,8 +154,18 @@ - (BOOL)isReloadingContext:(DoricContext *)context {
- (DoricContext *)matchContext:(NSString *)source {
source = [[source stringByReplacingOccurrencesOfString:@".js"
withString:@""]
stringByReplacingOccurrencesOfString:@".ts"
withString:@""
];
for (DoricContext *context in [DoricContextManager.instance aliveContexts]) {
if ([source containsString:context.source] || [context.source isEqualToString:@"__dev__"]) {
NSString *contextSource = [[context.source stringByReplacingOccurrencesOfString:@".js"
withString:@""]
stringByReplacingOccurrencesOfString:@".ts"
withString:@""
];
if ([source isEqualToString:contextSource] || [contextSource isEqualToString:@"__dev__"]) {
return context;
}
}