mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-10 22:45:24 +08:00
Initial commit
This commit is contained in:
35
ReactKit/Base/RCTModuleMethod.m
Normal file
35
ReactKit/Base/RCTModuleMethod.m
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#import "RCTModuleMethod.h"
|
||||
|
||||
@implementation RCTModuleMethod
|
||||
|
||||
- (instancetype)initWithSelector:(SEL)selector
|
||||
JSMethodName:(NSString *)JSMethodName
|
||||
arity:(NSUInteger)arity
|
||||
blockArgumentIndexes:(NSIndexSet *)blockArgumentIndexes
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_selector = selector;
|
||||
_JSMethodName = [JSMethodName copy];
|
||||
_arity = arity;
|
||||
_blockArgumentIndexes = [blockArgumentIndexes copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
NSString *blocks = @"no block args";
|
||||
if (self.blockArgumentIndexes.count > 0) {
|
||||
NSMutableString *indexString = [NSMutableString string];
|
||||
[self.blockArgumentIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
|
||||
[indexString appendFormat:@", %tu", idx];
|
||||
}];
|
||||
blocks = [NSString stringWithFormat:@"block args at %@", [indexString substringFromIndex:2]];
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"<%@: %p; exports -%@ as %@; %@>", NSStringFromClass(self.class), self, NSStringFromSelector(self.selector), self.JSMethodName, blocks];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user