Fix - argument type in RCTEventEmitter
Reviewed By: javache Differential Revision: D6528139 fbshipit-source-id: 170c2359bcc67131330d091e3707124018053938
This commit is contained in:
parent
fbf0aed3ac
commit
eaa84997ce
|
@ -39,6 +39,6 @@
|
|||
- (void)stopObserving;
|
||||
|
||||
- (void)addListener:(NSString *)eventName;
|
||||
- (void)removeListeners:(NSInteger)count;
|
||||
- (void)removeListeners:(double)count;
|
||||
|
||||
@end
|
||||
|
|
|
@ -84,12 +84,13 @@ RCT_EXPORT_METHOD(addListener:(NSString *)eventName)
|
|||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(removeListeners:(NSInteger)count)
|
||||
RCT_EXPORT_METHOD(removeListeners:(double)count)
|
||||
{
|
||||
if (RCT_DEBUG && count > _listenerCount) {
|
||||
int currentCount = (int)count;
|
||||
if (RCT_DEBUG && currentCount > _listenerCount) {
|
||||
RCTLogError(@"Attempted to remove more %@ listeners than added", [self class]);
|
||||
}
|
||||
_listenerCount = MAX(_listenerCount - count, 0);
|
||||
_listenerCount = MAX(_listenerCount - currentCount, 0);
|
||||
if (_listenerCount == 0) {
|
||||
[self stopObserving];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue