react-native
Version:
A framework for building native apps using React
45 lines (37 loc) • 1.23 kB
Flow
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
;
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
import type {RequestBody} from './convertRequestBody';
import type {RCTNetworkingEventDefinitions} from './RCTNetworkingEventDefinitions.flow';
import type {NativeResponseType} from './XMLHttpRequest';
declare const RCTNetworking: interface {
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
eventType: K,
// $FlowFixMe[invalid-computed-prop]
listener: (...$ElementType<RCTNetworkingEventDefinitions, K>) => mixed,
context?: mixed,
): EventSubscription,
sendRequest(
method: string,
trackingName: string,
url: string,
headers: {...},
data: RequestBody,
responseType: NativeResponseType,
incrementalUpdates: boolean,
timeout: number,
callback: (requestId: number) => void,
withCredentials: boolean,
): void,
abortRequest(requestId: number): void,
clearCookies(callback: (result: boolean) => void): void,
};
export default RCTNetworking;