RCTBundleURLProvider.h
3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/Foundation.h>
extern NSString *const RCTBundleURLProviderUpdatedNotification;
extern const NSUInteger kRCTBundleURLProviderDefaultPort;
@interface RCTBundleURLProvider : NSObject
/**
* Set default settings on NSUserDefaults.
*/
- (void)setDefaults;
/**
* Reset every settings to default.
*/
- (void)resetToDefaults;
/**
* Returns the jsBundleURL for a given bundle entrypoint and
* the fallback offline JS bundle if the packager is not running.
* if resourceName or extension are nil, "main" and "jsbundle" will be
* used, respectively.
*/
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
fallbackResource:(NSString *)resourceName
fallbackExtension:(NSString *)extension;
/**
* Returns the jsBundleURL for a given bundle entrypoint and
* the fallback offline JS bundle if the packager is not running.
*/
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
fallbackResource:(NSString *)resourceName;
/**
* Returns the jsBundleURL for a given bundle entrypoint and
* the fallback offline JS bundle. If resourceName or extension
* are nil, "main" and "jsbundle" will be used, respectively.
*/
- (NSURL *)jsBundleURLForFallbackResource:(NSString *)resourceName
fallbackExtension:(NSString *)extension;
/**
* 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;
/**
* The IP address or hostname of the packager.
*/
@property (nonatomic, copy) NSString *jsLocation;
@property (nonatomic, assign) BOOL enableLiveReload;
@property (nonatomic, assign) BOOL enableMinification;
@property (nonatomic, assign) BOOL enableDev;
+ (instancetype)sharedSettings;
/**
Given a hostname for the packager and a bundle root, returns the URL to the js bundle. Generally you should use the
instance method -jsBundleURLForBundleRoot:fallbackResource: which includes logic to guess if the packager is running
and fall back to a pre-packaged bundle if it is not.
*/
+ (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
packagerHost:(NSString *)packagerHost
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