mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
allow fetching any resource under js folder via packager
Summary: This is a simple hook to allow native side to fetch any file under the js root folder via packager. Historically, only the `main.jsbundle` is fetched via the packager. This then allows fetching local file like a json file that lives under the same root js folder Reviewed By: yungsters Differential Revision: D4037730 fbshipit-source-id: a2d6eb5e30d148fee573d413fc4036d0189f4938
This commit is contained in:
committed by
Facebook Github Bot
parent
4804190be1
commit
150c522be9
@@ -32,6 +32,15 @@ extern const NSUInteger kRCTBundleURLProviderDefaultPort;
|
||||
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
|
||||
fallbackResource:(NSString *)resourceName;
|
||||
|
||||
/**
|
||||
* Returns the resourceURL for a given bundle entrypoint and
|
||||
* the fallback offline resource file if the packager is not running.
|
||||
*/
|
||||
- (NSURL *)resourceURLForResourceRoot:(NSString *)root
|
||||
resourceName:(NSString *)name
|
||||
resourceExtension:(NSString *)extension
|
||||
offlineBundle:(NSBundle *)offlineBundle;
|
||||
|
||||
/**
|
||||
* Returns the URL of the packager server.
|
||||
*/
|
||||
@@ -58,4 +67,13 @@ extern const NSUInteger kRCTBundleURLProviderDefaultPort;
|
||||
enableDev:(BOOL)enableDev
|
||||
enableMinification:(BOOL)enableMinification;
|
||||
|
||||
/**
|
||||
* Given a hostname for the packager and a resource path (including "/"), return the URL to the resource.
|
||||
* In general, please use the instance method to decide if the packager is running and fallback to the pre-packaged
|
||||
* resource if it is not: -resourceURLForResourceRoot:resourceName:resourceExtension:offlineBundle:
|
||||
*/
|
||||
+ (NSURL *)resourceURLForResourcePath:(NSString *)path
|
||||
packagerHost:(NSString *)packagerHost
|
||||
query:(NSString *)query;
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user