Turn on Flow for EventEmitter

Reviewed By: sahrens

Differential Revision: D5732809

fbshipit-source-id: b8241120188b2b64af12249b2f00a43bea3b58a4
This commit is contained in:
Eli White authored and Facebook Github Bot committed 2017-08-30 11:52:28 -07:00
1 parent 1f9fc0ee3a
commit dd92dba3da
5 files changed
+10 -6

No files matched your search

@@ -38,7 +38,7 @@ class MissingNativeEventEmitterShim extends EventEmitter {
}
// EventEmitter
addListener(eventType: string, listener: Function, context: ?Object): EmitterSubscription {
addListener(eventType: string, listener: Function, context: ?Object) {
this.throwMissingNativeModule();
}
+3 -1
View File
@@ -394,7 +394,9 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
_clearSubscriptions(): void {
(this._subscriptions || []).forEach(sub => {
sub.remove();
if (sub) {
sub.remove();
}
});
this._subscriptions = [];
}
+1 -1
View File
@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EmitterSubscription
* @noflow
* @flow
*/
'use strict';
+3 -1
View File
@@ -18,6 +18,8 @@ const EventHolder = require('EventHolder');
const invariant = require('fbjs/lib/invariant');
const keyOf = require('fbjs/lib/keyOf');
import type EmitterSubscription from 'EmitterSubscription';
const TYPES_KEY = keyOf({__types: true});
/**
@@ -79,7 +81,7 @@ const EventEmitterMixin = {
return this.__getEventEmitter().emitAndHold(eventType, a, b, c, d, e, _);
},
addListener: function(eventType, listener, context) {
addListener: function(eventType, listener, context): EmitterSubscription {
return this.__getEventEmitter().addListener(eventType, listener, context);
},
@@ -67,8 +67,8 @@ class KeyboardSpacerIOS extends Component<Props, State> {
this._unRegisterEvents();
}
_keyboardWillShowSubscription: { remove: Function };
_keyboardWillHideSubscription: { remove: Function };
_keyboardWillShowSubscription: { +remove: Function };
_keyboardWillHideSubscription: { +remove: Function };
_registerEvents = () => {
this._keyboardWillShowSubscription = Keyboard.addListener(