1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | #import <UIKit/UIKit.h>
|
9 |
|
10 | #import <React/RCTDefines.h>
|
11 |
|
12 | extern NSString *const RCTJavaScriptLoaderErrorDomain;
|
13 |
|
14 | NS_ENUM(NSInteger) {
|
15 | RCTJavaScriptLoaderErrorNoScriptURL = 1,
|
16 | RCTJavaScriptLoaderErrorFailedOpeningFile = 2,
|
17 | RCTJavaScriptLoaderErrorFailedReadingFile = 3,
|
18 | RCTJavaScriptLoaderErrorFailedStatingFile = 3,
|
19 | RCTJavaScriptLoaderErrorURLLoadFailed = 3,
|
20 | RCTJavaScriptLoaderErrorBCVersion = 4,
|
21 | RCTJavaScriptLoaderErrorBCNotSupported = 4,
|
22 |
|
23 | RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously = 1000,
|
24 | };
|
25 |
|
26 | NS_ENUM(NSInteger) {
|
27 | RCTSourceFilesChangedCountNotBuiltByBundler = -2,
|
28 | RCTSourceFilesChangedCountRebuiltFromScratch = -1,
|
29 | };
|
30 |
|
31 | @interface RCTLoadingProgress : NSObject
|
32 |
|
33 | @property (nonatomic, copy) NSString *status;
|
34 | @property (strong, nonatomic) NSNumber *done;
|
35 | @property (strong, nonatomic) NSNumber *total;
|
36 |
|
37 | @end
|
38 |
|
39 | @interface RCTSource : NSObject
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | @property (strong, nonatomic, readonly) NSURL *url;
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | @property (strong, nonatomic, readonly) NSData *data;
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | @property (nonatomic, readonly) NSUInteger length;
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | @property (nonatomic, readonly) NSInteger filesChangedCount;
|
69 |
|
70 | @end
|
71 |
|
72 | typedef void (^RCTSourceLoadProgressBlock)(RCTLoadingProgress *progressData);
|
73 | typedef void (^RCTSourceLoadBlock)(NSError *error, RCTSource *source);
|
74 |
|
75 | @interface RCTJavaScriptLoader : NSObject
|
76 |
|
77 | + (void)loadBundleAtURL:(NSURL *)scriptURL
|
78 | onProgress:(RCTSourceLoadProgressBlock)onProgress
|
79 | onComplete:(RCTSourceLoadBlock)onComplete;
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | + (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL
|
90 | runtimeBCVersion:(int32_t)runtimeBCVersion
|
91 | sourceLength:(int64_t *)sourceLength
|
92 | error:(NSError **)error;
|
93 |
|
94 | @end
|