mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-04 21:09:21 +08:00
Add "setJsBundlesDirectory" method to CatalystInstanceImpl
Differential Revision: D6042493 fbshipit-source-id: 950c6d6bdc2e0b62b14c9bcfc86233159a002c67
This commit is contained in:
committed by
Facebook Github Bot
parent
21917ab7bf
commit
b5651d945c
@@ -210,6 +210,10 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
jniSetSourceURL(remoteURL);
|
||||
}
|
||||
|
||||
/* package */ void setJsBundlesDirectory(String directoryPath) {
|
||||
jniSetJsBundlesDirectory(directoryPath);
|
||||
}
|
||||
|
||||
/* package */ void loadScriptFromAssets(AssetManager assetManager, String assetURL, boolean loadSynchronously) {
|
||||
mSourceURL = assetURL;
|
||||
jniLoadScriptFromAssets(assetManager, assetURL, loadSynchronously);
|
||||
@@ -221,6 +225,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
}
|
||||
|
||||
private native void jniSetSourceURL(String sourceURL);
|
||||
private native void jniSetJsBundlesDirectory(String directoryPath);
|
||||
private native void jniLoadScriptFromAssets(AssetManager assetManager, String assetURL, boolean loadSynchronously);
|
||||
private native void jniLoadScriptFromFile(String fileName, String sourceURL, boolean loadSynchronously);
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.facebook.react.common.DebugServerException;
|
||||
|
||||
/**
|
||||
@@ -98,7 +97,20 @@ public abstract class JSBundleLoader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the script, returning the URL of the source it loaded.
|
||||
* This loader is used to wrap other loaders and set js bundles directory before executing
|
||||
* application script.
|
||||
*/
|
||||
public static JSBundleLoader createSplitBundlesLoader(
|
||||
final String jsBundlesDirectory, final JSBundleLoader delegate) {
|
||||
return new JSBundleLoader() {
|
||||
@Override
|
||||
public String loadScript(CatalystInstanceImpl instance) {
|
||||
instance.setJsBundlesDirectory(jsBundlesDirectory);
|
||||
return delegate.loadScript(instance);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** Loads the script, returning the URL of the source it loaded. */
|
||||
public abstract String loadScript(CatalystInstanceImpl instance);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user