@@ -22,14 +22,6 @@ type NativeModule = {
22
22
...
23
23
} ;
24
24
25
- type NativeEventEmitterOptions = $ReadOnly < { |
26
- __SECRET_DISABLE_CALLS_INTO_MODULE_DO_NOT_USE_OR_YOU_WILL_BE_FIRED : boolean ,
27
- | } > ;
28
-
29
- const DEFAULT_NATIVE_EVENT_EMITTER_OPTIONS = {
30
- __SECRET_DISABLE_CALLS_INTO_MODULE_DO_NOT_USE_OR_YOU_WILL_BE_FIRED : false ,
31
- } ;
32
-
33
25
/**
34
26
* Abstract base class for implementing event-emitting modules. This implements
35
27
* a subset of the standard EventEmitter node module API.
@@ -38,15 +30,9 @@ export default class NativeEventEmitter<
38
30
EventDefinitions : { ...} ,
39
31
> extends EventEmitter< EventDefinitions > {
40
32
_nativeModule : ?NativeModule ;
41
- _disableCallsIntoModule : boolean ;
42
33
43
- constructor (
44
- nativeModule : ?NativeModule ,
45
- options : NativeEventEmitterOptions = DEFAULT_NATIVE_EVENT_EMITTER_OPTIONS ,
46
- ) {
34
+ constructor ( nativeModule : ?NativeModule ) {
47
35
super ( RCTDeviceEventEmitter . sharedSubscriber ) ;
48
- this . _disableCallsIntoModule =
49
- options . __SECRET_DISABLE_CALLS_INTO_MODULE_DO_NOT_USE_OR_YOU_WILL_BE_FIRED ;
50
36
if ( Platform . OS === 'ios' ) {
51
37
invariant ( nativeModule , 'Native module cannot be null.' ) ;
52
38
this . _nativeModule = nativeModule ;
@@ -58,7 +44,7 @@ export default class NativeEventEmitter<
58
44
listener : ( ...$ElementType < EventDefinitions , K > ) => mixed ,
59
45
context : $FlowFixMe ,
60
46
) : EmitterSubscription < EventDefinitions , K > {
61
- if ( this . _nativeModule != null && ! this . _disableCallsIntoModule ) {
47
+ if ( this . _nativeModule != null ) {
62
48
this . _nativeModule . addListener ( eventType ) ;
63
49
}
64
50
return super . addListener ( eventType , listener , context ) ;
@@ -67,7 +53,7 @@ export default class NativeEventEmitter<
67
53
removeAllListeners< K : $Keys < EventDefinitions > > ( eventType : ?K ) : void {
68
54
invariant ( eventType , 'eventType argument is required.' ) ;
69
55
const count = this . listenerCount ( eventType ) ;
70
- if ( this . _nativeModule != null && ! this . _disableCallsIntoModule ) {
56
+ if ( this . _nativeModule != null ) {
71
57
this . _nativeModule . removeListeners ( count ) ;
72
58
}
73
59
super.removeAllListeners(eventType);
@@ -76,7 +62,7 @@ export default class NativeEventEmitter<
76
62
removeSubscription < K : $Keys < EventDefinitions > > (
77
63
subscription : EmitterSubscription < EventDefinitions , K > ,
78
64
): void {
79
- if ( this . _nativeModule != null && ! this . _disableCallsIntoModule ) {
65
+ if ( this . _nativeModule != null ) {
80
66
this . _nativeModule . removeListeners ( 1 ) ;
81
67
}
82
68
super.removeSubscription(subscription);
0 commit comments