react-native/Libraries/EventEmitter
Rahul Jiresal 0e8c3ff463 Add a removeListener method to DeviceEventEmitter for Framework consi…
Summary:
The Framework is inconsistent in how listeners are removed in certain classes. This issue has been discussed in https://github.com/facebook/react-native/issues/6493.

For example,

**DeviceEventEmitter**

```javascript
/* Current */
this.keyboardHideObserver = DeviceEventEmitter.addListener('keyboardWillHide', this.keyboardWillHide);
this.keyboardHideObserver.remove();

/* Expected (maybe in addition to the current API) */
DeviceEventEmitter.addListener('keyboardWillHide', this.keyboardWillHide);
DeviceEventEmitter.removeListener('keyboardWillHide', this.keyboardWillHide);
```
**AppStateIOS**

```javascript
AppStateIOS.addEventListener('change', this.handleAppStateChange);
AppStateIOS.removeEventListener('change', this.handleAppStateChange);
```

The API should be consistent, and preferably should allow both ways of removing the listeners.

Currently, developers who tried to use the second way of removing the listeners get an error for function not found. Due to the lack of documenta
Closes https://github.com/facebook/react-native/pull/6884

Differential Revision: D3341235

Pulled By: nicklockwood

fbshipit-source-id: 87431e8b667f46ad002d4a6e3ca07cbc1e6b4007
2016-05-24 11:45:51 -07:00
..
EmitterSubscription.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
EventEmitter.js Add a removeListener method to DeviceEventEmitter for Framework consi… 2016-05-24 11:45:51 -07:00
EventEmitterWithHolding.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
EventHolder.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
EventSubscription.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
EventSubscriptionVendor.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
EventValidator.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
NativeEventEmitter.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
RCTDeviceEventEmitter.js Updated AppState module to use new emitter system 2016-05-23 09:13:37 -07:00
RCTNativeAppEventEmitter.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
mixInEventEmitter.js Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00