Add API to reset CxxModuleWrapper's module pointer
Reviewed By: mhorowitz Differential Revision: D4914335 fbshipit-source-id: f28f57c2e74d590dacfb85d8027747837f768fdc
This commit is contained in:
parent
db8efd9c4b
commit
17020ff9af
|
@ -2,7 +2,6 @@
|
|||
|
||||
package com.facebook.react.cxxbridge;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
@ -52,4 +51,12 @@ public class CxxModuleWrapperBase implements NativeModule
|
|||
protected CxxModuleWrapperBase(HybridData hd) {
|
||||
mHybridData = hd;
|
||||
}
|
||||
|
||||
// Replace the current native module held by this wrapper by a new instance
|
||||
protected void resetModule(HybridData hd) {
|
||||
if (hd != mHybridData) {
|
||||
mHybridData.resetNative();
|
||||
mHybridData = hd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue