From 57b5c7596bda094240efce28a9ec132aacee2f18 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Mon, 27 Apr 2020 15:14:12 +0800 Subject: [PATCH] feat:when reload doriccontext,release the js resource --- doric-android/doric/src/main/java/pub/doric/DoricContext.java | 1 + doric-iOS/Pod/Classes/DoricContext.m | 1 + 2 files changed, 2 insertions(+) diff --git a/doric-android/doric/src/main/java/pub/doric/DoricContext.java b/doric-android/doric/src/main/java/pub/doric/DoricContext.java index 33a0e1c7..cd647fad 100644 --- a/doric-android/doric/src/main/java/pub/doric/DoricContext.java +++ b/doric-android/doric/src/main/java/pub/doric/DoricContext.java @@ -199,6 +199,7 @@ public class DoricContext { } public void reload(String script) { + getDriver().destroyContext(getContextId()); for (DoricJavaPlugin javaPlugin : mPluginMap.values()) { javaPlugin.onTearDown(); } diff --git a/doric-iOS/Pod/Classes/DoricContext.m b/doric-iOS/Pod/Classes/DoricContext.m index 04914b2a..0f3ebb50 100644 --- a/doric-iOS/Pod/Classes/DoricContext.m +++ b/doric-iOS/Pod/Classes/DoricContext.m @@ -97,6 +97,7 @@ - (void)build:(CGSize)size { } - (void)reload:(NSString *)script { + [self.driver destroyContext:self.contextId]; self.rootNode.viewId = nil; self.script = script; [self.driver createContext:self.contextId script:script source:self.source];