Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[WEEX-671][iOS] extendCallNative method move to instance jscontext (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hjhcn authored and cxfeng1 committed Nov 29, 2018
1 parent 4e1aacb commit 980892a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
13 changes: 13 additions & 0 deletions ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#import "WXJSFrameworkLoadProtocol.h"
#import "WXJSFrameworkLoadDefaultImpl.h"
#import "WXHandlerFactory.h"
#import "WXExtendCallNativeManager.h"

#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
Expand Down Expand Up @@ -1125,6 +1126,10 @@ + (void)mountContextEnvironment:(JSContext*)context
NSString * levelStr = [[args lastObject] toString];
[WXBridgeContext handleConsoleOutputWithArgument:args logLevel:(WXLogFlag)[levelMap[levelStr] integerValue]];
};

context[@"extendCallNative"] = ^(JSValue *value ) {
return [WXBridgeContext extendCallNative:[value toDictionary]];
};
}

+ (void)handleConsoleOutputWithArgument:(NSArray *)arguments logLevel:(WXLogFlag)logLevel
Expand All @@ -1149,4 +1154,12 @@ + (void)handleConsoleOutputWithArgument:(NSArray *)arguments logLevel:(WXLogFlag
}
}];
}

+(id)extendCallNative:(NSDictionary *)dict
{
if(dict){
return [WXExtendCallNativeManager sendExtendCallNativeEvent:dict];
}
return @(-1);
}
@end
12 changes: 0 additions & 12 deletions ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,6 @@ - (void)createDefaultContext
_jsContext[@"clearTimeoutWeex"] = ^(JSValue *ret) {
[weakSelf triggerClearTimeout:[ret toString]];
};

_jsContext[@"extendCallNative"] = ^(JSValue *value ) {
return [weakSelf extendCallNative:[value toDictionary]];
};
}

-(void)addInstance:(NSString *)instance callback:(NSString *)callback
Expand Down Expand Up @@ -545,12 +541,4 @@ - (void)triggerClearTimeout:(NSString *)ret
}
}

-(id)extendCallNative:(NSDictionary *)dict
{
if(dict){
return [WXExtendCallNativeManager sendExtendCallNativeEvent:dict];
}
return @(-1);
}

@end

0 comments on commit 980892a

Please sign in to comment.