mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Adds types to Event Emitters and migrates the most relevant modules using them in `react-native`. The most relevant file of this diff is `react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js` with the Flow tests showing and testing the behavior of the new types Changelog: [Internal] Add types for Event Emitters and subclasses Reviewed By: motiz88 Differential Revision: D25587936 fbshipit-source-id: feeb09f9ad15d383cdd82deaaaba0d12b94e868b
26 lines
607 B
JavaScript
26 lines
607 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import EventEmitter from '../../vendor/emitter/EventEmitter';
|
|
import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter';
|
|
|
|
/**
|
|
* Mock the NativeEventEmitter as a normal JS EventEmitter.
|
|
*/
|
|
export default class NativeEventEmitter<
|
|
EventDefinitions: {...},
|
|
> extends EventEmitter<EventDefinitions> {
|
|
constructor() {
|
|
super(RCTDeviceEventEmitter.sharedSubscriber);
|
|
}
|
|
}
|