Files
react-native/Libraries/Network/NativeNetworkingIOS.js
T
Michał Pierzchała e8037cb942 Add spec for Networking (#24892)
Summary:
Part of #24875, adds a spec for Networking. Since `sendRequest` methods are different for both platforms, I had to create 2 spec files as Flow would merge their definitions even when I added `Platform.OS` check

## Changelog

[General] [Added] - TM spec for Networking
Pull Request resolved: https://github.com/facebook/react-native/pull/24892

Reviewed By: RSNara

Differential Revision: D15543067

Pulled By: fkgozali

fbshipit-source-id: 2b91114dfa45e7899bbb139656a30a6fd52e31db
2019-05-29 18:33:28 -07:00

39 lines
999 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.
*
* @flow
* @format
*/
'use strict';
import type {TurboModule} from 'RCTExport';
import * as TurboModuleRegistry from 'TurboModuleRegistry';
export interface Spec extends TurboModule {
+sendRequest: (
query: {|
method: string,
url: string,
data: Object,
headers: Object,
responseType: Object, // TODO: Use stricter type.
incrementalUpdates: boolean,
timeout: number,
withCredentials: boolean,
|},
callback: (requestId: number) => mixed,
) => void;
+abortRequest: (requestId: number) => void;
+clearCookies: (callback: (result: boolean) => mixed) => void;
// RCTEventEmitter
+addListener: (eventName: string) => void;
+removeListeners: (count: number) => void;
}
export default TurboModuleRegistry.getEnforcing<Spec>('Networking');