Files
react-native/Libraries/vendor/emitter/_EventSubscription.js
T
Tim Yung 32f36fe105 RN: Fix Prettier Formatting Errors (#32524)
Summary:
Ignores the `Libraries/Renderer/` directory of files which are synchronized from React (and should not be modified).

Also, formats some EventEmitter modules that for some reason were missed when I upgraded to Prettier v2.x.

## Changelog

[Internal]

Pull Request resolved: https://github.com/facebook/react-native/pull/32524

Test Plan:
```
yarn run format-check
```

Reviewed By: javache

Differential Revision: D32129837

Pulled By: yungsters

fbshipit-source-id: 1cb42cec210508db499850e13f77beefdb35eb25
2021-11-09 00:33:12 -08:00

46 lines
1.2 KiB
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 strict
*/
'use strict';
import {type EventSubscription} from './EventSubscription';
import type EventSubscriptionVendor from './_EventSubscriptionVendor';
/**
* EventSubscription represents a subscription to a particular event. It can
* remove its own subscription.
*/
class _EventSubscription<EventDefinitions: {...}, K: $Keys<EventDefinitions>>
implements EventSubscription
{
eventType: K;
key: number;
subscriber: EventSubscriptionVendor<EventDefinitions>;
listener: ?(...$ElementType<EventDefinitions, K>) => mixed;
context: ?$FlowFixMe;
/**
* @param {EventSubscriptionVendor} subscriber the subscriber that controls
* this subscription.
*/
constructor(subscriber: EventSubscriptionVendor<EventDefinitions>) {
this.subscriber = subscriber;
}
/**
* Removes this subscription from the subscriber that controls it.
*/
remove(): void {
this.subscriber.removeSubscription(this);
}
}
module.exports = _EventSubscription;