mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
346417caac
Summary: This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries/vendor` have been rewritten to use relative requires. Talking to cpojer, the vendored code in RN can be modified directly. This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change. Closes #24769. [General] [Changed] - Migrate vendored code from Haste to path-based imports Pull Request resolved: https://github.com/facebook/react-native/pull/24807 Differential Revision: D15316831 Pulled By: cpojer fbshipit-source-id: 19475823ce9f506600bd09b001156e306bff4db8
41 lines
922 B
JavaScript
41 lines
922 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 strict-local
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import type EventSubscriptionVendor from './EventSubscriptionVendor';
|
|
|
|
/**
|
|
* EventSubscription represents a subscription to a particular event. It can
|
|
* remove its own subscription.
|
|
*/
|
|
class EventSubscription {
|
|
eventType: string;
|
|
key: number;
|
|
subscriber: EventSubscriptionVendor;
|
|
|
|
/**
|
|
* @param {EventSubscriptionVendor} subscriber the subscriber that controls
|
|
* this subscription.
|
|
*/
|
|
constructor(subscriber: EventSubscriptionVendor) {
|
|
this.subscriber = subscriber;
|
|
}
|
|
|
|
/**
|
|
* Removes this subscription from the subscriber that controls it.
|
|
*/
|
|
remove() {
|
|
this.subscriber.removeSubscription(this);
|
|
}
|
|
}
|
|
|
|
module.exports = EventSubscription;
|