feat:when reload doriccontext,release the js resource

This commit is contained in:
pengfei.zhou 2020-04-27 15:14:12 +08:00 committed by osborn
parent 12fcf71526
commit 57b5c7596b
2 changed files with 2 additions and 0 deletions

View File

@ -199,6 +199,7 @@ public class DoricContext {
} }
public void reload(String script) { public void reload(String script) {
getDriver().destroyContext(getContextId());
for (DoricJavaPlugin javaPlugin : mPluginMap.values()) { for (DoricJavaPlugin javaPlugin : mPluginMap.values()) {
javaPlugin.onTearDown(); javaPlugin.onTearDown();
} }

View File

@ -97,6 +97,7 @@ - (void)build:(CGSize)size {
} }
- (void)reload:(NSString *)script { - (void)reload:(NSString *)script {
[self.driver destroyContext:self.contextId];
self.rootNode.viewId = nil; self.rootNode.viewId = nil;
self.script = script; self.script = script;
[self.driver createContext:self.contextId script:script source:self.source]; [self.driver createContext:self.contextId script:script source:self.source];