iOS bundle
This commit is contained in:
1
iOS/Pod/Assets/bundle
Symbolic link
1
iOS/Pod/Assets/bundle
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../js-framework/bundle
|
1
iOS/Pod/Assets/dist
Symbolic link
1
iOS/Pod/Assets/dist
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../debugger/dist
|
@@ -1 +0,0 @@
|
||||
../../../js-framework/bundle/doric-lib.js
|
@@ -1 +0,0 @@
|
||||
../../../js-framework/bundle/doric-sandbox.js
|
@@ -87,14 +87,14 @@ - (void)initJSExecutor {
|
||||
|
||||
- (void)initDoricEnvironment {
|
||||
[self loadBuiltinJS:DORIC_BUNDLE_SANDBOX];
|
||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:DORIC_BUNDLE_LIB ofType:@"js"];
|
||||
NSString *path = [DoricBundle() pathForResource:DORIC_BUNDLE_LIB ofType:@"js" inDirectory:@"bundle"];
|
||||
NSString *jsContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
|
||||
[self.jsExecutor loadJSScript:[self packageModuleScript: DORIC_MODULE_LIB content:jsContent]
|
||||
source: [@"Module://" stringByAppendingString:DORIC_MODULE_LIB]];
|
||||
}
|
||||
|
||||
- (void)loadBuiltinJS:(NSString *)fileName {
|
||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:DORIC_BUNDLE_SANDBOX ofType:@"js"];
|
||||
NSString *path = [DoricBundle() pathForResource:DORIC_BUNDLE_SANDBOX ofType:@"js" inDirectory:@"bundle"];
|
||||
NSString *jsContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
|
||||
[self.jsExecutor loadJSScript:jsContent source:[@"Assets://" stringByAppendingString:fileName]];
|
||||
}
|
||||
|
@@ -10,3 +10,5 @@
|
||||
void DoricLog(NSString * _Nonnull format, ...);
|
||||
|
||||
UIColor* _Nonnull DoricColor(NSNumber * _Nonnull number);
|
||||
|
||||
NSBundle *DoricBundle();
|
||||
|
@@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
#import "DoricUtil.h"
|
||||
#import "DoricContext.h"
|
||||
|
||||
void DoricLog(NSString * _Nonnull format, ...) {
|
||||
va_list args;
|
||||
@@ -23,3 +24,9 @@ void DoricLog(NSString * _Nonnull format, ...) {
|
||||
b = ((colorValue >> 0) & 0xff)/255.0f;
|
||||
return [UIColor colorWithRed:r green:g blue:b alpha:a];
|
||||
}
|
||||
|
||||
NSBundle *DoricBundle() {
|
||||
NSBundle *bundle = [NSBundle bundleForClass:[DoricContext class]];
|
||||
NSURL *url = [bundle URLForResource:@"Doric" withExtension:@"bundle"];
|
||||
return [NSBundle bundleWithURL:url];
|
||||
}
|
||||
|
Reference in New Issue
Block a user