Skip to content

Commit f5f4787

Browse files
yungstersfacebook-github-bot
authored andcommitted
RN: Delete NativeEventEmitter Options
Summary: Removes the `options` argument in the `NativeEventEmitter` constructor. It was only being used for an experimental flag that is no longer necessary. Changelog: [General][Removed] - Removed second optional argument of `NativeEventEmitter` constructor Reviewed By: RSNara Differential Revision: D26138239 fbshipit-source-id: 0481ce44f0464668e3a6e7ffaf079d17c87afd42
1 parent d54b286 commit f5f4787

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

Libraries/EventEmitter/NativeEventEmitter.js

+4-18
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ type NativeModule = {
2222
...
2323
};
2424

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-
3325
/**
3426
* Abstract base class for implementing event-emitting modules. This implements
3527
* a subset of the standard EventEmitter node module API.
@@ -38,15 +30,9 @@ export default class NativeEventEmitter<
3830
EventDefinitions: {...},
3931
> extends EventEmitter<EventDefinitions> {
4032
_nativeModule: ?NativeModule;
41-
_disableCallsIntoModule: boolean;
4233

43-
constructor(
44-
nativeModule: ?NativeModule,
45-
options: NativeEventEmitterOptions = DEFAULT_NATIVE_EVENT_EMITTER_OPTIONS,
46-
) {
34+
constructor(nativeModule: ?NativeModule) {
4735
super(RCTDeviceEventEmitter.sharedSubscriber);
48-
this._disableCallsIntoModule =
49-
options.__SECRET_DISABLE_CALLS_INTO_MODULE_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
5036
if (Platform.OS === 'ios') {
5137
invariant(nativeModule, 'Native module cannot be null.');
5238
this._nativeModule = nativeModule;
@@ -58,7 +44,7 @@ export default class NativeEventEmitter<
5844
listener: (...$ElementType<EventDefinitions, K>) => mixed,
5945
context: $FlowFixMe,
6046
): EmitterSubscription<EventDefinitions, K> {
61-
if (this._nativeModule != null && !this._disableCallsIntoModule) {
47+
if (this._nativeModule != null) {
6248
this._nativeModule.addListener(eventType);
6349
}
6450
return super.addListener(eventType, listener, context);
@@ -67,7 +53,7 @@ export default class NativeEventEmitter<
6753
removeAllListeners<K: $Keys<EventDefinitions>>(eventType: ?K): void {
6854
invariant(eventType, 'eventType argument is required.');
6955
const count = this.listenerCount(eventType);
70-
if (this._nativeModule != null && !this._disableCallsIntoModule) {
56+
if (this._nativeModule != null) {
7157
this._nativeModule.removeListeners(count);
7258
}
7359
super.removeAllListeners(eventType);
@@ -76,7 +62,7 @@ export default class NativeEventEmitter<
7662
removeSubscription<K: $Keys<EventDefinitions>>(
7763
subscription: EmitterSubscription<EventDefinitions, K>,
7864
): void {
79-
if (this._nativeModule != null && !this._disableCallsIntoModule) {
65+
if (this._nativeModule != null) {
8066
this._nativeModule.removeListeners(1);
8167
}
8268
super.removeSubscription(subscription);

0 commit comments

Comments
 (0)